Diff Coverage

Diff: origin/master...HEAD, staged and unstaged changes

Source File Diff Coverage (%) Missing Lines
hyper_parallel/components/functional/dsa_sparse_attention_rescale.py 0.0% 136,160-162
hyper_parallel/components/functional/dsa_sparse_attention_rescale.py
132
133
134
135
136
137
138
139
140
        grad_softmax_max: torch.Tensor,
        grad_softmax_sum: torch.Tensor,
    ) -> tuple:
        """Run the explicit sparse- and fusion-attention backward operators."""
        del grad_softmax_max, grad_softmax_sum
        (
            query_nope,
            compressed_kv,
            query_rope,
156
157
158
159
160
161
162
163
164
165
166
            for tensor in (query_nope, compressed_kv, query_rope, key_rope)
        ]
        grad_output = rearrange(output_scale * grad_rescaled_output, "b s n d -> (b s) n d")
        rescaled_output_tnd = rearrange(rescaled_output, "b s n d -> (b s) n d")
        if query_rope.size(-1) > 0:
            grad_output = grad_output[:, :, :-query_rope.size(-1)]
            rescaled_output_tnd = rescaled_output_tnd[:, :, :-query_rope.size(-1)]

        grad_query_nope, grad_key, grad_value, grad_query_rope, grad_key_rope = (
            torch.ops.custom.npu_sparse_flash_attention_grad_enhance(
                query_nope_tnd,