diff options
Diffstat (limited to 'source/slang/hlsl.meta.slang')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index e00108e96..8b0bade6e 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -24382,6 +24382,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] __init<U : __BuiltinArithmeticType>(CoopVec<U, N> other) { this.copyFrom(other); @@ -24421,6 +24422,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] void copyFrom<U : __BuiltinArithmeticType>(CoopVec<U,N> other) { __target_switch @@ -24429,6 +24431,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti __intrinsic_asm "$0 = $1"; case hlsl_coopvec_poc: __intrinsic_asm ".CopyFrom"; + case optix_coopvec: + __intrinsic_asm "optixCoopVecCvt<$TR>(*($0));"; default: if (__isFloat<T>() && __isInt<U>()) this = __int_to_float_cast<T>(other); @@ -24438,7 +24442,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti this = __real_cast<T>(other); else if (__isInt<T>() && __isInt<U>()) this = __int_cast<T>(other); - } + } } /// Fill all elements of this CoopVec with the specified value. @@ -24591,6 +24595,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [__NoSideEffect] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] static CoopVec<T, N> load(ByteAddressBuffer buffer, int32_t byteOffset16ByteAligned = 0) { __target_switch @@ -24606,6 +24611,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti CoopVec<T, N> ret; ret.__Load(buffer, byteOffset16ByteAligned); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecLoad<$TR>((CUdeviceptr)(&($0)));"; default: var vec = CoopVec<T, N>(); for(int i = 0; i < N; ++i) @@ -24618,6 +24625,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [__NoSideEffect] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] static CoopVec<T, N> load(RWByteAddressBuffer buffer, int32_t byteOffset16ByteAligned = 0) { __target_switch @@ -24633,6 +24641,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti CoopVec<T, N> ret; ret.__Load(buffer, byteOffset16ByteAligned); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecLoad<$TR>((CUdeviceptr)(&($0)));"; default: var vec = CoopVec<T, N>(); for(int i = 0; i < N; ++i) @@ -24702,6 +24712,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [__NoSideEffect] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] static CoopVec<T, N> load<let M : int>(__constref groupshared const T[M] data, int32_t byteOffset16ByteAligned = 0) { static_assert(N <= M, "The destination vector size is smaller than the input."); @@ -24716,6 +24727,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti CoopVec<T, N> ret; ret.__Load(data, __byteToElemOffset<T>(byteOffset16ByteAligned)); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecLoad<$TR>((CUdeviceptr)(&($0)));"; default: CoopVec<T,N> result; for(int i = 0; i < N; ++i) @@ -24922,6 +24935,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] This add(This other) { __target_switch @@ -24932,6 +24946,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti This ret = this; ret.__mutAdd(other); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecAdd($0, $1)"; default: return __pureAdd(other); } } @@ -24957,6 +24973,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] This sub(This other) { __target_switch @@ -24967,6 +24984,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti This ret = this; ret.__mutSub(other); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecSub($0, $1)"; default: return __pureSub(other); } } @@ -24992,6 +25011,7 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] + [require(optix_coopvec)] This mul(This other) { __target_switch @@ -25002,6 +25022,8 @@ struct CoopVec<T : __BuiltinArithmeticType, let N : int> : IArray<T>, IArithmeti This ret = this; ret.__mutMul(other); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecMul($0, $1)"; default: return __pureMul(other); } } @@ -25621,6 +25643,7 @@ CoopVec<T, N> operator *(const T lhs, CoopVec<T, N> rhs) [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] CoopVec<T, N> min<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x, CoopVec<T, N> y) { __target_switch @@ -25636,6 +25659,8 @@ CoopVec<T, N> min<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x, CoopVec<T, N> ret = x; ret.__mutMin(y); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecMin($0, $1)"; default: CoopVec<T, N> ret; for(int i = 0; i < N; ++i) @@ -25648,6 +25673,7 @@ CoopVec<T, N> min<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x, [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] CoopVec<T, N> max<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x, CoopVec<T, N> y) { __target_switch @@ -25663,6 +25689,8 @@ CoopVec<T, N> max<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x, CoopVec<T, N> ret = x; ret.__mutMax(y); return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecMax($0, $1)"; default: CoopVec<T, N> ret; for(int i = 0; i < N; ++i) @@ -25809,6 +25837,7 @@ CoopVec<T, N> clamp<T : __BuiltinIntegerType, let N : int>(CoopVec<T, N> x, Coop // [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] CoopVec<T, N> step<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> edge, CoopVec<T, N> x) { __target_switch @@ -25825,6 +25854,8 @@ CoopVec<T, N> step<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> ed { result:$$CoopVec<T, N> = OpExtInst glsl450 Step $edge $x; }; + case optix_coopvec: + __intrinsic_asm "optixCoopVecStep($0, $1)"; default: CoopVec<T, N> ret; for(int i = 0; i < N; ++i) @@ -25890,6 +25921,43 @@ CoopVec<T, N> log<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x) // [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] +CoopVec<T, N> log2<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x) +{ + __target_switch + { + default: + CoopVec<T, N> ret; + for(int i = 0; i < N; ++i) + ret[i] = log2(x[i]); + return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecLog2($0)"; + } +} + +// [ForceInline] +[require(cooperative_vector)] +[require(hlsl_coopvec_poc)] +[require(optix_coopvec)] +CoopVec<T, N> exp2<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x) +{ + __target_switch + { + default: + CoopVec<T, N> ret; + for(int i = 0; i < N; ++i) + ret[i] = exp2(x[i]); + return ret; + case optix_coopvec: + __intrinsic_asm "optixCoopVecExp2($0)"; + } +} + +// [ForceInline] +[require(cooperative_vector)] +[require(hlsl_coopvec_poc)] +[require(optix_coopvec)] CoopVec<T, N> tanh<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x) { __target_switch @@ -25906,6 +25974,8 @@ CoopVec<T, N> tanh<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> x) { result:$$CoopVec<T, N> = OpExtInst glsl450 Tanh $x; }; + case optix_coopvec: + __intrinsic_asm "optixCoopVecTanh($0)"; default: CoopVec<T, N> ret; for(int i = 0; i < N; ++i) @@ -25944,6 +26014,7 @@ CoopVec<T, N> atan<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> yO // [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] CoopVec<T, N> fma<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> a, CoopVec<T, N> b, CoopVec<T, N> c) { // TODO: Investigate, why does this fail if it's not inlined @@ -25963,6 +26034,8 @@ CoopVec<T, N> fma<T : __BuiltinFloatingPointType, let N : int>(CoopVec<T, N> a, { result:$$CoopVec<T, N> = OpExtInst glsl450 Fma $a $b $c; }; + case optix_coopvec: + __intrinsic_asm "optixCoopVecFFMA($0, $1, $2)"; default: CoopVec<T, N> ret; for(int i = 0; i < N; ++i) @@ -26695,6 +26768,7 @@ CoopVec<T, M> coopVecMatMulAddPacked<T : __BuiltinArithmeticType, let M : int, l [ForceInline] [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] __generic<T : __BuiltinArithmeticType, let M : int, let K : int, U : __BuiltinArithmeticType> CoopVec<T, M> coopVecMatMulAdd( CoopVec<U, K> input, @@ -26746,6 +26820,7 @@ if(buffer.isRW) /// @param matrixInterpretation Specifies how to interpret the values in the matrix. [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] void coopVecOuterProductAccumulate<T : __BuiltinArithmeticType, let M : int, let N : int>( CoopVec<T, M> a, CoopVec<T, N> b, @@ -26773,6 +26848,8 @@ void coopVecOuterProductAccumulate<T : __BuiltinArithmeticType, let M : int, let OpCapability CooperativeVectorTrainingNV; OpCooperativeVectorOuterProductAccumulateNV $matrixPtr $matrixOffset $a $b $memoryLayoutSpirv $matrixInterpretationSpirv $matrixStride; }; + case optix_coopvec: + __intrinsic_asm "optixCoopVecOuterProductAccumulate($0, $1, (CUdeviceptr)(&$2), $3, $4)"; default: for (int i = 0; i < M; ++i) { @@ -26836,6 +26913,7 @@ void coopVecOuterProductAccumulate<T : __BuiltinArithmeticType, let M : int, let /// @param offset Byte offset into the buffer. [require(cooperative_vector)] [require(hlsl_coopvec_poc)] +[require(optix_coopvec)] void coopVecReduceSumAccumulate<T : __BuiltinArithmeticType, let N : int>( CoopVec<T, N> v, $(buffer.type) buffer, @@ -26855,6 +26933,8 @@ void coopVecReduceSumAccumulate<T : __BuiltinArithmeticType, let N : int>( OpCapability CooperativeVectorTrainingNV; OpCooperativeVectorReduceSumAccumulateNV $bufferPtr $offset $v; }; + case optix_coopvec: + __intrinsic_asm "optixCoopVecReduceSumAccumulate($0, (CUdeviceptr)(&$1), $2)"; default: for (int i = 0; i < N; ++i) { |
