Skip to content

fla: fix relative import depth in triton_ascend backend - #1074

Draft
jiqing-feng wants to merge 1 commit into
huggingface:mainfrom
jiqing-feng:fla-triton-ascend-import
Draft

fla: fix relative import depth in triton_ascend backend#1074
jiqing-feng wants to merge 1 commit into
huggingface:mainfrom
jiqing-feng:fla-triton-ascend-import

Conversation

@jiqing-feng

@jiqing-feng jiqing-feng commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

TritonAscendUtilsBackend.is_available() does from ...utils import IS_NPU,
but the backend lives at fla.ops.utils.backends.triton_ascend, so three levels
up resolves to the non-existent fla.ops.utils.utils.

This is not dormant on non-NPU hardware. BackendRegistry.register() calls
_update_active_backend() -> can_use() -> is_available() eagerly at import
time, so the broken import raises on every platform, taking down any op routed
through chunk_local_cumsumchunk_gated_delta_rule among them.

The two chunk_*_cumsum methods reach the sibling cumsum module by absolute
path through a relative prefix; switched to plain relative imports, which
AGENTS.md asks for anyway.

This is a vendoring bug, not an upstream one — fla-org/flash-linear-attention
uses absolute imports here and is unaffected. The depth was miscounted when the
snapshot was converted to the relative imports AGENTS.md requires, so there is
nothing to report upstream.

Validation

chunk_gated_delta_rule imports and runs after the fix; it raised on import
before. Checked on Intel Arc Pro B60, torch 2.13.0+xpu, but the failure is not
backend specific.

The triton_ascend utils backend lives at
`fla.ops.utils.backends.triton_ascend`, so `from ...utils import IS_NPU`
resolves to the non-existent `fla.ops.utils.utils`.

This is not dormant code on non-NPU platforms: `BackendRegistry.register()`
calls `_update_active_backend()` -> `backend.can_use()` -> `is_available()`
eagerly at import time, so the broken import raises on every platform.
That kills any op routed through `chunk_local_cumsum` (e.g.
`chunk_gated_delta_rule`) on non-CUDA backends.

Use the correct depth for `IS_NPU` and package-relative imports for the
sibling `cumsum` module.
@github-actions github-actions Bot added the chore Version bumps, releases, misc maintenance label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Version bumps, releases, misc maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant