Spaces:
Running
Running
Download src/playground/cuda/delay_queue.cu from ThomasHeisig/MHRN-Space: direct link, hf CLI and curl.
- Browser
- Download file 830 Bytes
-
https://huggingface.co/spaces/ThomasHeisig/MHRN-Space/resolve/main/src/playground/cuda/delay_queue.cu
- Command line
-
hf download hf://spaces/ThomasHeisig/MHRN-Space/src/playground/cuda/delay_queue.cu
-
curl -L -o delay_queue.cu https://huggingface.co/spaces/ThomasHeisig/MHRN-Space/resolve/main/src/playground/cuda/delay_queue.cu
830 Bytes
| extern "C" __global__ void pan_delay_consume(unsigned n, unsigned slot, double* queue, double* currents) { | |
| unsigned i=blockIdx.x*blockDim.x+threadIdx.x;if(i>=n)return; | |
| currents[i]=queue[slot*n+i];queue[slot*n+i]=0.0; | |
| } | |
| // One writer per target, preserving the supplied emission order without atomics on current. | |
| extern "C" __global__ void pan_delay_enqueue(unsigned n, unsigned count, unsigned tick, | |
| const unsigned* targets,const unsigned* delays,const double* amplitudes,double* queue,unsigned* invalid) { | |
| unsigned i=blockIdx.x*blockDim.x+threadIdx.x;if(i>=n)return; | |
| for(unsigned e=0;e<count;++e) if(targets[e]==i) { | |
| unsigned slot=((tick%65)+delays[e])%65; | |
| double value=queue[slot*n+i]+amplitudes[e]; | |
| if(!isfinite(value)) atomicExch(invalid,1u); | |
| queue[slot*n+i]=value; | |
| } | |
| } | |