Skip to content

Commit ea5af44

Browse files
committed
Fixed sharedmemsize name in workgroup, add some few utilities for faster mul by i,-i in complex
1 parent cd06068 commit ea5af44

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

include/nbl/builtin/hlsl/complex.hlsl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,23 @@ NBL_REGISTER_OBJ_TYPE(complex_t<float64_t2>,::nbl::hlsl::alignment_of_v<float64_
378378
NBL_REGISTER_OBJ_TYPE(complex_t<float64_t3>,::nbl::hlsl::alignment_of_v<float64_t3>)
379379
NBL_REGISTER_OBJ_TYPE(complex_t<float64_t4>,::nbl::hlsl::alignment_of_v<float64_t4>)
380380

381+
382+
383+
--------------------------------------------- Some more functions that come in handy --------------------------------------
384+
// Fast mul by i
385+
template<typename Scalar>
386+
complex_t<Scalar> rotateLeft(NBL_CONST_REF_ARG(complex_t<Scalar>) value)
387+
{
388+
complex_t<Scalar> retVal = {- value.imag(), value.real()};
389+
return retVal;
390+
}
391+
392+
// Fast mul by -i
393+
template<typename Scalar>
394+
complex_t<Scalar> rotateRight(NBL_CONST_REF_ARG(complex_t<Scalar>) value)
395+
{
396+
complex_t<Scalar> retVal = {value.imag(), -value.real()};
397+
return retVal;
398+
}
399+
381400
#endif

include/nbl/builtin/hlsl/workgroup/fft.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct exchangeValues<SharedMemoryAdaptor, float64_t>
9595

9696
// Get the required size (in number of uint32_t elements) of the workgroup shared memory array needed for the FFT
9797
template <typename scalar_t, uint32_t WorkgroupSize>
98-
NBL_CONSTEXPR uint32_t sharedMemSize = (sizeof(complex_t<scalar_t>) / sizeof(uint32_t)) * WorkgroupSize;
98+
NBL_CONSTEXPR uint32_t SharedMemoryDWORDs = (sizeof(complex_t<scalar_t>) / sizeof(uint32_t)) * WorkgroupSize;
9999

100100
} //namespace fft
101101

0 commit comments

Comments
 (0)