Passing any feature in the device-isa trait which is not supported by the host
was causing a compilation failure.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Can you make the test check for the diagnose message? Also, do we have a test to verify an isa trait is properly handled?
clang/lib/Parse/ParseOpenMP.cpp | ||
---|---|---|
2533 | Why doesn't this diagnose nothing? |
I don't see a point in adding a diagnostic message when a feature is not found valid for a certain target. Because if it satisfies one of the host or device compilation, then it will definitely fail in the other.
I have added new tests to check that isa trait is handled properly in the next revision.
clang/lib/Parse/ParseOpenMP.cpp | ||
---|---|---|
2533 | Because an isa-feature will fail at least once, for either host compilation or device compilation. So, no point in always giving a warning. |
clang/lib/Parse/ParseOpenMP.cpp | ||
---|---|---|
2533 | That is debatable. First, if I compile for a single architecture there is no device compilation and it should warn. |
clang/lib/Parse/ParseOpenMP.cpp | ||
---|---|---|
2533 | ASTContext &Context = getASTContext(); std::function<void(StringRef)> DiagUnknownTrait = [this, ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ CE](StringRef ISATrait) { ┊ // TODO Track the selector locations in a way that is accessible here to ┊ // improve the diagnostic location. ┊ Diag(CE->getBeginLoc(), diag::warn_unknown_declare_variant_isa_trait) ┊ ┊ ┊ << ISATrait; }; TargetOMPContext OMPCtx(Context, std::move(DiagUnknownTrait), ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ getCurFunctionDecl(), DSAStack->getConstructTraits()); Already exists (SemaOpenMP). Why do we need a second, different diagnostic? |
clang/lib/Parse/ParseOpenMP.cpp | ||
---|---|---|
2533 | Isn't giving a remark better than a warning, when we know in many cases this will be hit during a normal (expected) compilation for target offload? I am fine changing it to a warning if you feel strongly about this. |
clang/lib/Parse/ParseOpenMP.cpp | ||
---|---|---|
2533 |
isa trait 'foo' is not known to the current target; verify the spelling or consider restricting the context selector with the 'arch' selector further. // Note that we put isa last so that the other conditions are checked first. // This allows us to issue warnings wrt. isa only if we match otherwise. __OMP_TRAIT_SELECTOR(device, isa, true) |
- Used a common diagnostic warning warn_unknown_declare_variant_isa_trait for ParseOpenMP and SemaOpenMP for decalre variant and metadirectives.
- Split lit codegen tests into two files, one requiring amdgpu-registered target and another for host only.
- Added warning message lit test at an appropriate place.
Why doesn't this diagnose nothing?