[PATCH] D124790: [HLSL] Enable half type for hlsl.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 3 11:51:31 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/Basic/LangOptions.cpp:197
 
-  // OpenCL has half keyword
-  Opts.Half = Opts.OpenCL;
+  // OpenCL and HLSL have half keyword
+  Opts.Half = Opts.OpenCL || Opts.HLSL;
----------------
python3kgae wrote:
> aaron.ballman wrote:
> > Shouldn't this be looking for HLSL 2018? Or shader model 6.2?
> half keyword is always available.
> Without enable_16bit_types, half will be like using half=float.
> With enable_16bit_types, half will be real half.
> 
> The check for HLSL 2018 and shader model 6.2 will be in another PR, still WIP. I'll add FIXME about it.
> half keyword is always available.
> Without enable_16bit_types, half will be like using half=float.
> With enable_16bit_types, half will be real half.

Is there room for change here, or is this strictly required by HLSL? This strikes me as just begging to confuse users into creating ODR violations. CC @beanz 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124790/new/

https://reviews.llvm.org/D124790



More information about the cfe-commits mailing list