Skip to content

Update the megablox kernel utility function to support float16 #1423

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

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

Conversation

wang2yn84
Copy link
Collaborator

Description

The current function only switches between bf16 and f32. It should also take into consideration of f16.

Tests

No functional change. Reply on presubmit tests.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

Update the megablox kernel utility function to also cover float16.
Copy link
Collaborator

@bvandermoon bvandermoon left a comment

Choose a reason for hiding this comment

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

LGTM. Re: No functional change, rely on presubmit test.

Is there a presubmit test that will test what you need here? Or do we need to try running with these dtypes separately?

@wang2yn84
Copy link
Collaborator Author

LGTM. Re: No functional change, rely on presubmit test.

Is there a presubmit test that will test what you need here? Or do we need to try running with these dtypes separately?

That's a good question. Which script shall I run to validate the change?

@bvandermoon
Copy link
Collaborator

LGTM. Re: No functional change, rely on presubmit test.
Is there a presubmit test that will test what you need here? Or do we need to try running with these dtypes separately?

That's a good question. Which script shall I run to validate the change?

@yangyuwei do you have a GPU-specific test that @wang2yn84 could use here?

@@ -55,5 +55,7 @@ def select_input_dtype(lhs: jnp.ndarray, rhs: jnp.ndarray) -> jnp.dtype:
# input precision, we need to convert bf16 argument to fp32 beforehand.
if supports_bfloat16_matmul() and lhs.dtype == jnp.bfloat16 and rhs.dtype == jnp.bfloat16:
return jnp.bfloat16
elif lhs.dtype == jnp.float16 and rhs.dtype == jnp.float16:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am don't think any current test will cover newly added float16 type?

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

Successfully merging this pull request may close these issues.

4 participants