slang icon indicating copy to clipboard operation
slang copied to clipboard

Slang doesn't propagate the correct DXC error in some cases (validation errors) and gives "dxc: : error : Generic error during compilation" instead

Open savage309 opened this issue 4 years ago • 4 comments

I have pretty complicated raygen shader, in which due to miss-include I ended up having code calling WorldRayDirection() intrinsic (this intrinsic is not valid in raygen, just closest/miss shaders)

Trying to compiler that with Slang gives error "dxc: : error : Generic error during compilation"

If I just generate HLSL and compile it myself with dxc, I get

error: validation errors
error: at '%7913 = call float @dx.op.worldRayDirection.f32(i32 148, i8 2)' in block '#316' of function '?rayGenDirectLightingSampled@@YAXXZ': Opcode WorldRayDirection not valid in shader model lib_6_3(raygeneration)
error: at '%7912 = call float @dx.op.worldRayDirection.f32(i32 148, i8 1)' in block '#316' of function '?rayGenDirectLightingSampled@@YAXXZ': Opcode WorldRayDirection not valid in shader model lib_6_3(raygeneration)
error: at '%7911 = call float @dx.op.worldRayDirection.f32(i32 148, i8 0)' in block '#316' of function '?rayGenDirectLightingSampled@@YAXXZ': Opcode WorldRayDirection not valid in shader model lib_6_3(raygeneration)

I think Slang doesn't report back the validation errors. Having to dump to HLSL in our env is quite time consuming and a lot of people don't know how to do that. This issue has been quite problematic recently.

Can Slang just report back everything that DXC produced, including the validation errors? Thanks.

savage309 avatar Jul 09 '21 23:07 savage309

To my knowledge Slang doesn’t do anything to filter out or remove error messages coming from dxc. We should just be passing along whatever messages dxc gave us without changes.

My worry would be that this is a behavior difference between invoking dxc as an executable vs. a library. We can try to dig into why this difference arises and see if it suggests a solution strategy.

tangent-vector avatar Jul 10 '21 00:07 tangent-vector

Yep, it seems like the validation errors are stripped out of the log that Slang reports. Everything else is there.

I think this might be a recent regression - I am not 100% sure, but I think I've seen those reported in the past.

savage309 avatar Jul 10 '21 00:07 savage309

I see what you mean - that there might be different behavior when invoking as library .. if thats the case, can we get a mode where you invoke it as a process separately and FOPEN the result ... having the validation errors log is quite important for the developers efficiency.

savage309 avatar Jul 10 '21 01:07 savage309

I think this was addressed in https://github.com/shader-slang/slang/commit/2a80bcfa96089967b299eea0454d9debe52fa0f6

apanteleev avatar Apr 01 '22 20:04 apanteleev

Given this bug age and that it might be addressed per @apanteleev comment, closing. If still an issue, feel free to open new issue with repro so we can get someone to re-triage.

natduca avatar Dec 01 '23 19:12 natduca