Skip to content

Conversation

LegNeato
Copy link
Contributor

@LegNeato LegNeato commented Sep 22, 2025

I thought we could use the fallback code from compiler-builtins but I guess not? Most things were broken....I got confused as to what was provided by whom.

I had AI bang out our implementations, I did not write them.

This is generating a lot of code, perhaps better to generate a fn and then have everything call it?

I added an example and confirmed it works / passes.

@LegNeato
Copy link
Contributor Author

@nnethercote this changes math_builder_methods

@LegNeato
Copy link
Contributor Author

@nnethercote I am going to rebase this on your macro changes, they look better.

@LegNeato LegNeato marked this pull request as draft September 22, 2025 07:27
I thought we could use the fallback code from compiler-builtins
but I guess not? Most things were broken.

I had AI bang out our implementations, I did not write them.

This is generating a lot of code, perhaps better to generate a fn and then
have everything call it?

I added an example and confirmed it works / passes.
@LegNeato LegNeato marked this pull request as ready for review September 23, 2025 03:10
@LegNeato
Copy link
Contributor Author

I'm still not sure this is right, as I would expect to be using compiler-builtins instead of reimplementing the fallback ourselves. But I am a bit out of my depth as to how all this fits together.

@LegNeato LegNeato marked this pull request as draft September 24, 2025 17:36
Ok, figured out how to do this and now I reuse whatever is in
`compiler-builtins`. It doesn't have every operation though, so we still need
to emulate some parts of some ops.
@LegNeato LegNeato marked this pull request as ready for review September 25, 2025 01:42
@LegNeato
Copy link
Contributor Author

LegNeato commented Sep 25, 2025

Ok, so what was happening is we were getting called recursively because compiler-builtins shift apis call shift intrinsics (?) and we were infinite looping on codegen. Then I only used the compiler-builtins division stuff and had AI manually implement the shifts, but for some reason the compiler division stuff was only operating on the lower (?) 64 bits so the CPU vs GPU comparisons were not passing. Which leaves this where it ended up...we manually impl the shifts to prevent recursion, we manually impl division to get around the 64bit only, and the rest we use the compiler-builtin exports

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.

1 participant