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

[Pallas TPU] Refactor ref indexers to transforms and support ref bitcast. #23583

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Sep 11, 2024

[Pallas TPU] Refactor ref indexers to transforms and support ref bitcast.

This cl refactors Pallas memref indexers to transforms which can support different ref transforms: indexing, bitcast (added in this cl), reshape (to be added) and others. Like indexer, user can apply multiple transforms to same memref, eg:

ref.bitcast(type1).at[slice1].bitcast(type2).bitcast(type3).at[slice2]...

Jaxpr Preview (apply multiple transforms to same ref):

{ lambda ; a:MemRef<None>{int32[16,256]} b:MemRef<None>{int32[8,128]}. let
    c:i32[8,128] <- a[:8,:][bitcast(int16[16,256])][bitcast(float16[16,256])][:,:128][bitcast(int32[8,128])][:,:]
    b[:,:] <- c
  in () }

Tested:

  • DMA with bitcasted ref
  • Load from bitcasted ref
  • Store to bitcasted ref
  • Multiple transforms
  • Interpret Mode for ref transforms (updated discharge rules)

@copybara-service copybara-service bot changed the title [Pallas TPU] Refactor indexers for ref to transforms and support ref bitcast. [Pallas TPU] Refactor ref indexers to transforms and support ref bitcast. Sep 11, 2024
@copybara-service copybara-service bot force-pushed the test_667836131 branch 4 times, most recently from aa94911 to 7b1f64c Compare September 16, 2024 00:39
…ast.

This cl refactors Pallas memref indexers to transforms which can support different ref transforms: indexing, bitcast (added in this cl), reshape (to be added) and others. Like indexer, user can apply multiple transforms to same memref, eg:
```
ref.bitcast(type1).at[slice1].bitcast(type2).bitcast(type3).at[slice2]...
```

Jaxpr Preview (apply multiple transforms to same ref):
```
{ lambda ; a:MemRef<None>{int32[16,256]} b:MemRef<None>{int32[8,128]}. let
    c:i32[8,128] <- a[:8,:][bitcast(int16[16,256])][bitcast(float16[16,256])][:,:128][bitcast(int32[8,128])][:,:]
    b[:,:] <- c
  in () }
```

Tested:
* DMA with bitcasted ref
* Load from bitcasted ref
* Store to bitcasted ref
* Multiple transforms
* Interpret Mode for ref transforms (updated discharge rules)
PiperOrigin-RevId: 674961388
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