Skip to content

Error: Internal Compiler Error (codegen): "there was an error in verifying the lgenfe output!" #12117

@ezyang

Description

@ezyang

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    internalsmodule: buildBuild system issuesmodule: cudaRelated to torch.cuda, and CUDA support in generaltriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions