Skip to content

[ENHANCEMENT] Store the broadcast style of the blocks in BlockSparseArrayStyle #60

@mtfishman

Description

@mtfishman

Store the broadcast style of the blocks in BlockSparseArrayStyle. This would help with generic code, for example if a block sparse array has GPU blocks, BlockSparseArrayStyle could keep track of that by storing the block style as the corresponding GPU array broadcasting style. Then, we can more accurately determine the destination type of a broadcast expression from all of the arguments that were input.

This is analogous to how ArrayLayouts.MemoryLayout definitions for BlockArrays.jlBlockedArray store information about the memory layout of the blocks: https://github.com/JuliaArrays/BlockArrays.jl/blob/v1.4.0/src/blocklinalg.jl#L82-L83

Currently, we determine the output type just based on the first argument:

return similar(first(m.args), elt, combine_axes(axes.(m.args)...))
which is not ideal and could make some mistakes (like making a destination with sparse blocks that should have dense blocks).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions