-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Open
Labels
internalsmodule: buildBuild system issuesBuild system issuesmodule: cudaRelated to torch.cuda, and CUDA support in generalRelated to torch.cuda, and CUDA support in generaltriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
If you attempt to put at::optional in a struct which is used from a cu file, you may get this error:
Error: Internal Compiler Error (codegen): "there was an error in verifying the lgenfe output!"
A minimal reproduction is this program:
#include "optional.h"
struct O {
O() {} // required!
at::optional<int> x;
};
void blah() {
O o;
}
compiled with nvcc -c main.cu -std=c++11 --expt-relaxed-constexpr (the --expt-relaxed-constexpr is mandatory).
There is a simple workaround for this problem: explicitly initialize all optional fields in your constructor. So for example, the following code will compile successfully:
#include "optional.h"
struct O {
O() : x() {}
at::optional<int> x;
};
void blah() {
O o;
}
Separius
Metadata
Metadata
Assignees
Labels
internalsmodule: buildBuild system issuesBuild system issuesmodule: cudaRelated to torch.cuda, and CUDA support in generalRelated to torch.cuda, and CUDA support in generaltriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module