llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.75k stars 11.43k forks source link

[SPIRV][HLSL] Implement `frac` lowering #88059

Closed farzonl closed 1 month ago

farzonl commented 4 months ago

update the frac.hlsl unit tests: https://github.com/llvm/llvm-project/blob/1e6ce5e284f5c0e8d64eee21af727bb164eb3caf/clang/test/CodeGenHLSL/builtins/frac.hlsl#L2

example: https://shader-playground.timjones.io/020254826814c6bfb01e671c08c15db4

and implement the OpExtInst Fract Lowering: %13 = OpExtInst %v4float %1 Fract %12 https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Fract

damyanp commented 4 months ago

Need resolution to #87367 before doing this.

davidcook-msft commented 2 months ago

Issue to be re-evaluated and updated

farzonl commented 2 months ago

@davidcook-msft this ticket is now just add frac support for spirv. Should just be create a spirv intrinsic use our target switching so hlsl picks the right intrinsic. then update the existing tests and add new spirv backend tests

tex3d commented 1 month ago

Sign me up!

llvmbot commented 1 month ago

@llvm/issue-subscribers-clang-codegen

Author: Farzon Lotfi (farzonl)

- Create a frac intrinsic for spirv use the hlsl intrinsic switching to swap on target. update the frac.hlsl unit tests: https://github.com/llvm/llvm-project/blob/1e6ce5e284f5c0e8d64eee21af727bb164eb3caf/clang/test/CodeGenHLSL/builtins/frac.hlsl#L2 example: https://shader-playground.timjones.io/020254826814c6bfb01e671c08c15db4 and implement the `OpExtInst Fract` Lowering: `%13 = OpExtInst %v4float %1 Fract %12` https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Fract