fla: fix relative import depth in triton_ascend backend - #1074
Draft
jiqing-feng wants to merge 1 commit into
Draft
fla: fix relative import depth in triton_ascend backend#1074jiqing-feng wants to merge 1 commit into
jiqing-feng wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TritonAscendUtilsBackend.is_available()doesfrom ...utils import IS_NPU,but the backend lives at
fla.ops.utils.backends.triton_ascend, so three levelsup 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 importtime, so the broken import raises on every platform, taking down any op routed
through
chunk_local_cumsum—chunk_gated_delta_ruleamong them.The two
chunk_*_cumsummethods reach the siblingcumsummodule by absolutepath through a relative prefix; switched to plain relative imports, which
AGENTS.mdasks for anyway.This is a vendoring bug, not an upstream one —
fla-org/flash-linear-attentionuses absolute imports here and is unaffected. The depth was miscounted when the
snapshot was converted to the relative imports
AGENTS.mdrequires, so there isnothing to report upstream.
Validation
chunk_gated_delta_ruleimports and runs after the fix; it raised on importbefore. Checked on Intel Arc Pro B60,
torch 2.13.0+xpu, but the failure is notbackend specific.