Hey! I've been working on outsourcing neural networks onto the GPU. Since I am a beginner with hlsl (but I think I got a basic idea of hlsl etc now), this takes me so much time.
While I thought I'd be done now, I got the error "forced to unroll loop, but unrolling failed.". I've done some research and found that the predirectives
`#pragma exclude_renderers d3d11_9x` and `#pragma exclude_renderers d3x9` should fix this by disabling the directX version that has problems unrolling the loops. This didn't work sadly. Also putting an `[unroll]` before the loop doesn't do the trick. This just changes the error message to "can't unroll loops marked with loop attribute".
Here's the relevant part of my shader code:
struct Vec{
float component[30];
int length;
int pad1;
};
struct Mat{
Vec component[30];
int length;
int pad1;
int pad2;
int pad3;
};
StructuredBuffer w : register(t0); // didn't yet quite try and figure those register thingies out but I think I need them to transfer my compute buffers to the compute shader correctly
StructuredBuffer inputs : register(t2);
StructuredBuffer b : register(t3);
RWStructuredBuffer o : register(u1);
int w_l, i_l, b_l; // length of weights, inputs and bias
float DotProd(Vec a, Vec b){
float sum = 0;
for(int i=0; i
↧