-
Notifications
You must be signed in to change notification settings - Fork 24
Operation definitions for Bessel functions #1676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| ); | ||
| } | ||
|
|
||
| def BesselJ0 : EnzymeXLA_Op<"special.besselj0", [Pure, SameOperandsAndResultType, Elementwise]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for us to specialize j0 here? If we have the same implementation it lowers into anyways, no need for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagined those might have custom approximation lowerings but I'm not sure about that. Will see if I can find something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for one, mpfr seems to have separate implementations for the different bessels https://github.com/JuliaMath/SpecialFunctions.jl/blob/1743a8b7ac1565213e87de418765c594720929b6/src/bessel.jl#L682C1-L709C4
I'm not sure yet what the lowering in stablehlo would look like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in julia right now it just looks like they call custom c library functinos [which we can't do ourselves here anyways]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id probably just start with the more general one, and add the specialized one if we find a lowering for it later
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnzymeJAX Benchmarks
| Benchmark suite | Current: 45e39ae | Previous: 7054610 | Ratio |
|---|---|---|---|
scatter_sum / JaX / cpu / Primal |
0.000004400375899967912 s |
0.000004342221499973675 s |
1.01 |
scatter_sum / JaXPipe / cpu / Primal |
0.000004491189899999881 s |
0.000004368584500025463 s |
1.03 |
scatter_sum / JaX / tpu / Primal |
0.0001501408806 s |
0.0001383197025999 s |
1.09 |
scatter_sum / JaXPipe / tpu / Primal |
0.0001491218746999 s |
0.0001325478068999 s |
1.13 |
This comment was automatically generated by workflow using github-action-benchmark.
The order can be a different type (for example an integer)
|
The ops seem to be working, I've got them hooked up to Reactant locally. |
An operation is defined for each function listed here: https://specialfunctions.juliamath.org/stable/functions_overview/#Bessel-Functions
For now, all function arguments are mapped onto operation operands, as opposed to constant attributes.
Some of the variants are special cases of more general ones: