diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2025-07-03 23:53:02 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-04 06:53:02 +0000 |
| commit | b282c88d9743fc9bb60ef27cfa5d9cf58cccd60b (patch) | |
| tree | 0abd8598051b277c02e459affd66f67ce5028abe /source/slang/hlsl.meta.slang | |
| parent | b4fc380af5e390ca11892f9e657e653f6869c21b (diff) | |
Make copysign function differentiable (#7585)
* Initial plan
* Implement copysign forward and backward derivatives
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix copysign test format to use expected.txt file
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Add wgsl support to copysign and fix y==0 derivative case
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Add wgsl support to copysign helper functions
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix copysign derivative to return 0 when either x or y is 0
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Diffstat (limited to 'source/slang/hlsl.meta.slang')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 38f274984..7879fc493 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -7685,7 +7685,7 @@ matrix<T, N, M> ceil(matrix<T, N, M> x) /// @category math __generic<let N: int> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl)] vector<half,N> copysign_half(vector<half,N> x, vector<half,N> y) { let ux = reinterpret<vector<uint16_t,N>>(x); @@ -7702,7 +7702,7 @@ vector<half,N> copysign_half(vector<half,N> x, vector<half,N> y) /// @category math __generic<let N: int> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl)] vector<float,N> copysign_float(vector<float,N> x, vector<float,N> y) { let ux = reinterpret<vector<uint32_t,N>>(x); @@ -7719,7 +7719,7 @@ vector<float,N> copysign_float(vector<float,N> x, vector<float,N> y) /// @category math __generic<let N: int> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl)] vector<double,N> copysign_double(vector<double,N> x, vector<double,N> y) { let ux = reinterpret<vector<uint64_t,N>>(x); @@ -7740,7 +7740,7 @@ vector<T,N> __real_cast(vector<U,N> val); /// @category math __generic<T : __BuiltinFloatingPointType, let N: int> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl)] vector<T,N> copysign(vector<T,N> x, vector<T,N> y) { __target_switch @@ -7766,7 +7766,7 @@ vector<T,N> copysign(vector<T,N> x, vector<T,N> y) __generic<T : __BuiltinFloatingPointType> [__readNone] -[require(cpp_cuda_glsl_hlsl_metal_spirv)] +[require(cpp_cuda_glsl_hlsl_metal_spirv_wgsl)] T copysign(T x, T y) { __target_switch |
