Skip to content

Conversation

shoaibkamil
Copy link
Contributor

We had an internal report of a codegen error when lowering pow() in the D3D12Compute backend, producing incorrect HLSL like the following:

pow(_183, float _367 = _364 * _364;

The root issue was that this lowering path was directly injecting into the string representing the shader, rather than using a lowering path that will handle dealing with the arguments correctly. Also added a test that failed before this change; I can separate it out to its own file if that's better.

Copy link
Contributor

@slomp slomp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting the issue and fixing it!

@mcourteaux
Copy link
Contributor

Glancing at this PR, I wonder why the original code was bad. Why doesn't print_expr() print an Expr?

@alexreinking
Copy link
Member

Glancing at this PR, I wonder why the original code was bad. Why doesn't print_expr() print an Expr?

Apparently it doesn't return an rvalue expression in all cases. It ought to, imo, but that would be out of scope for this PR.

@alexreinking
Copy link
Member

Getting some incorrect values on webgpu -- that must be an llvm_main injection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants