Skip to content

[Codegen] Simplify bitcast folding with bufferized load #22712

@Yu-Zhewen

Description

@Yu-Zhewen

Currently, #22672 needs to match a long chain of operations to fold bitcasts into bufferized tensor loads:

  1. iree_codegen.load_from_buffer
  2. amdgpu.fat_raw_buffer_cast
  3. hal.interface.binding.subspan

However, this pattern matching is quite fragile.

A more robust solution is to push the bitcast directly onto the source memref of the iree_codegen.load_from_buffer op.

However, the current memref.reinterpret_cast operation doesn't support casting element types. Use memref.view, but it requires the memref to be contiguous.

Therefore, a cleaner solution would be to introduce a dedicated memref.bitcast (or similar).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions