[ROCm][CI] Add missing quantization methods and fix online quant test failures (#39801)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Andreas Karatzas
2026-04-27 15:08:57 -05:00
committed by GitHub
parent c8bbe05189
commit 5e2c37facd
9 changed files with 50 additions and 23 deletions
+4 -1
View File
@@ -352,7 +352,10 @@ def generate_rotation_matrix(d: int, seed: int, device: str = "cpu") -> torch.Te
gen = torch.Generator(device="cpu")
gen.manual_seed(seed)
G = torch.randn(d, d, generator=gen, device="cpu", dtype=torch.float32)
Q, R = torch.linalg.qr(G)
# torch.linalg.qr on CPU requires LAPACK, which some torch wheels
# (ROCm) ship without. Run QR on accelerator instead
qr_device = "cuda" if torch.cuda.is_available() else "cpu"
Q, R = torch.linalg.qr(G.to(qr_device))
diag_sign = torch.sign(torch.diag(R))
diag_sign[diag_sign == 0] = 1.0
Q = Q * diag_sign.unsqueeze(0)