Skip to content

Commit

Permalink
Change positionX to uint
Browse files Browse the repository at this point in the history
  • Loading branch information
gordicaleksa committed Jun 19, 2024
1 parent 66950f3 commit bb9eab8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llmc/cuda_utils.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ __device__ inline float blockReduce(float val, bool final_sync=false, float out_
// This gives us a random number from threadIdx/blockIdx + a single seed for the entire GPU
// todo - possibly overkill and we don't need such high quality random numbers? (tbd)
// http://eiserloh.net/noise/SquirrelNoise5.hpp
__device__ __host__ constexpr unsigned int SquirrelNoise5(int positionX, unsigned int seed)
__device__ __host__ constexpr unsigned int SquirrelNoise5(unsigned int positionX, unsigned int seed)
{
constexpr unsigned int SQ5_BIT_NOISE1 = 0xd2a80a3f; // 11010010101010000000101000111111
constexpr unsigned int SQ5_BIT_NOISE2 = 0xa884f197; // 10101000100001001111000110010111
constexpr unsigned int SQ5_BIT_NOISE3 = 0x6C736F4B; // 01101100011100110110111101001011
constexpr unsigned int SQ5_BIT_NOISE4 = 0xB79F3ABB; // 10110111100111110011101010111011
constexpr unsigned int SQ5_BIT_NOISE5 = 0x1b56c4f5; // 00011011010101101100010011110101
unsigned int mangledBits = (unsigned int) positionX;
unsigned int mangledBits = positionX;
mangledBits *= SQ5_BIT_NOISE1;
mangledBits += seed;
mangledBits ^= (mangledBits >> 9);
Expand Down

0 comments on commit bb9eab8

Please sign in to comment.