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

JIT_ERROR instead of generic fallback for FIRSTI binary op with UDTs #378

Open
eriknw opened this issue Jan 20, 2025 · 2 comments
Open

JIT_ERROR instead of generic fallback for FIRSTI binary op with UDTs #378

eriknw opened this issue Jan 20, 2025 · 2 comments

Comments

@eriknw
Copy link
Contributor

eriknw commented Jan 20, 2025

There are several pieces to this edge case and expected behavior, so please bear with me:

  • JIT_C_CONTROL is ON
  • The JIT is not set up correctly; for example, no C compiler is found
  • Use objects (e.g., Vectors) with a user-defined type
    • I did not define the C typedef such as with GxB_Type_new, but presumably this shouldn't matter since the JIT doesn't work
  • Use GxB_FIRSTI BinaryOp with e.g. ewise-mult

The expected behavior is no JIT is required at all, because this just needs to use the structure. If for some reason the JIT is required, the expected behavior when the JIT fails is to fall back to a generic method (for instance, the generic method works when JIT_C_CONTROL is OFF) instead of raising JIT_ERROR (but maybe I misread and raising is appropriate). Finally, I wouldn't expect a UDT without a C typedef (i.e., it's empty string) to be try to be used by the JIT.

This is with SuiteSparse:GraphBLAS 9.4.2

@DrTimothyAldenDavis
Copy link
Owner

Understood. I see where it's coming from.

The GxB_FIRSTI binaryop ignores the data type of its input, so it doesn't care about the data type. Thus, the operator is fine with the JIT even though the type is user defined.

The JIT can be used for cases when there's no factory kernel available for that particular case. There might be some typecasting going on, such as GxB_FIRSTI_UINT32 but the output is INT32, or something. I would need to look closer.

So the JIT control is on, and the kernel is supposed to be JIT'd. So the JIT kernel is attempted to be compiled, and it should work because the JIT control is on and the user should expect to seea JIT kernel compiled. But it fails because there's no compiler. That by definition is a JIT error, and so I return GxB_JIT_ERROR. Falling back to the generic case would mask the failure in a hard-to-diagnose way.

To detect if no compiler is available, it might be useful to try compiling a JIT kernel in a try/catch mechanism, right after calling GrB_init. Then if a failure occurs, just leave the JIT in the OFF state.

@eriknw
Copy link
Contributor Author

eriknw commented Jan 21, 2025

That makes sense, and yeah this is totally my fault for turning the JIT to ON, so the JIT_ERROR is actually helpful to surface my mistake.

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

No branches or pull requests

2 participants