This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] Restrict to supported targets
ClosedPublic

Authored by beanz on Aug 17 2022, 11:35 AM.

Details

Summary

Someday we would like to support HLSL on a wider range of targets, but
today targeting anything other than dxil is likly to cause lots of
headaches. This adds an error and tests to validate that the expected
target is dxil-?-shadermodel.

We will continue to do a best effort to ensure the code we write makes
it easy to support other targets (like SPIR-V), but this error will
prevent users from hitting frustrating errors for unsupported cases.

Diff Detail

Event Timeline

beanz created this revision.Aug 17 2022, 11:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2022, 11:35 AM
beanz requested review of this revision.Aug 17 2022, 11:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2022, 11:35 AM

I don't have particular concerns FWIW, but I'm not certain if others have opinions so I'm holding off on accepting for a bit.

clang/test/Driver/hlsl-lang-targets.hlsl
15

Thoughts on this change?

beanz updated this revision to Diff 456746.Aug 30 2022, 12:08 PM

Adding the FIXME suggested by @aaron.ballman. Thanks!

jcranmer-intel accepted this revision.Sep 1 2022, 12:56 PM

I don't necessarily know clang-specific code to have that valuable an opinion here, but I don't see anything wrong.

This revision is now accepted and ready to land.Sep 1 2022, 12:56 PM
Anastasia accepted this revision.Sep 2 2022, 3:57 AM

This makes sense. I believe the same applies to some other languages i.e. OpenCL, as the way clang evolved currently not all targets are compatible with all languages. In the future we might want to generalize this diagnostics to use in other cases too.

This revision was landed with ongoing or failed builds.Sep 2 2022, 11:42 AM
This revision was automatically updated to reflect the committed changes.