Skip to content

Why can't the fused_layer_norm support > 64KB BLOCK_SIZE #390

@yurilxc

Description

@yurilxc

Thanks for the tutorial! When learning fused_layer_norm, I see the capping on maximum block_size. I tried removing the constraint and indeed the results became incorrect. But I could not understand why such constraint exists. Does it mean there is an upperbound of BLOCK_SIZE, exceeding which can cause incorrect behaviors?

        MAX_FUSED_SIZE = 65536 // x.element_size()
        BLOCK_SIZE = min(MAX_FUSED_SIZE, triton.next_power_of_2(N))
        if N > BLOCK_SIZE:
            raise RuntimeError("This layer norm doesn't support feature dim >= 64KB.")

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