Skip to content
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

feat: add side_effect and backend_config to jit_call #425

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

avik-pal
Copy link
Collaborator

@avik-pal avik-pal commented Mar 3, 2025

No description provided.

@@ -36,6 +36,6 @@ module {
// CHECK-LABEL: @main
// CHECK-SAME: (%[[ARG0:.+]]: tensor<64xi64>) -> tensor<64xi64> {
// CHECK-NEXT: %[[CALL:.+]] = stablehlo.custom_call @enzymexla_compile_cpu(%arg0)
// CHECK-SAME: {api_version = 3 : i32, backend_config = "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00",
// CHECK-SAME: {api_version = 4 : i32, backend_config = {attr = "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wsmoses this PR does make this change and I am not sure it affects the kernel stuff in any way

Copy link
Member

Choose a reason for hiding this comment

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

no, this actually does need to stay the same (see above)

/* api_version*/
CustomCallApiVersionAttr::get(
rewriter.getContext(),
mlir::stablehlo::CustomCallApiVersion::
Copy link
Member

Choose a reason for hiding this comment

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

oh no this is actually an issue, this needs to keep its API as it was before (it is the calling convention for the setup)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

API_VERSION_STATUS_RETURNING_UNIFIED doesn't allow for a DictAttr

Copy link
Member

Choose a reason for hiding this comment

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

yeah, but we shouldn't change the attributes passed in

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if we pass backend_config to jit_call those need to be forwarded to the custom_call as well right?

Copy link
Member

Choose a reason for hiding this comment

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

so currently the backend config out of jitcall is the function pointer of the jitt'd function, which then is directly executed

@giordano
Copy link
Member

giordano commented Mar 3, 2025

Just to make it clear, tests here are failing, independently of the failure introduced by #426, so please don't merge this PR before both issues are fixed.

@wsmoses
Copy link
Member

wsmoses commented Mar 3, 2025

Just to make it clear, tests here are failing, independently of the failure introduced by #426, so please don't merge this PR before both issues are fixed.

yeah that later one should be fixed by #427

@giordano do we have a branch protection rule for the things expected to pass

@giordano
Copy link
Member

giordano commented Mar 3, 2025

The 3 "Build Enzyme-JAX" jobs are all expected to pass, like the code formatting ones. I see there are 3 expected jobs which don't exist anymore, those can be removed.


// CHECK-LABEL: func.func @main(%arg0: tensor<4xf32>) -> tensor<4xf32> {
func.func @main(%arg0: tensor<4xf32>) -> tensor<4xf32> {
// CHECK: stablehlo.custom_call @enzymexla_compile_cpu() {api_version = 3 : i32, backend_config = "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", has_side_effect = true} : () -> ()
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't the backend_config remain the same and get passed to the underlying func?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this needs fixing, the backend config needs to be compiled as part of CompileCall and this backend config should just be the attribute (at least that is what I figured out from the discussion above)

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