Repository navigation
[ZenCPU] Add zencpu Platform Runtime Logging and Docs #42726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
934be93
7fa2107
6ac6b41
f35e221
7555ddc
d24d0dc
8074d81
bc8c57d
6bda06d
0ca058a
04f3971
cffd91a
eea4fb6
aaf22b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,3 +66,26 @@ def test_dispatch_cpu_unquantized_gemm_zen_remove_weight(monkeypatch): | |
| utils.dispatch_cpu_unquantized_gemm(layer, remove_weight=True) | ||
|
|
||
| assert layer.weight.numel() == 0 | ||
|
|
||
|
|
||
| @pytest.mark.usefixtures("_mock_zentorch_linear_unary") | ||
| def test_dispatch_cpu_unquantized_gemm_logs_zentorch_dispatch(monkeypatch): | ||
|
Comment on lines
+71
to
+72
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be skipped if platform is not zen_cpu?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this is intentional. The test is a unit test for the dispatcher logic. It uses the Skipping on non-Zen hardware would mean the new logging code is never validated in CI. The pattern matches the two existing tests above it (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. although, would love to get your thoughts on adding UT for logging |
||
| monkeypatch.setattr(current_platform, "is_zen_cpu", lambda: True) | ||
| expected_prepacked = bool(utils.envs.VLLM_ZENTORCH_WEIGHT_PREPACK) and hasattr( | ||
| torch.ops.zentorch, "zentorch_weight_prepack_for_linear" | ||
| ) | ||
|
|
||
| log_calls = [] | ||
| monkeypatch.setattr( | ||
| utils.logger, "debug_once", lambda *args: log_calls.append(args) | ||
| ) | ||
|
|
||
| layer = torch.nn.Linear(16, 8, bias=True) | ||
| utils.dispatch_cpu_unquantized_gemm(layer, remove_weight=False) | ||
|
|
||
| assert log_calls == [ | ||
| ( | ||
| "CPU unquantized GEMM dispatch: using zentorch_linear_unary (prepacked=%s)", | ||
| expected_prepacked, | ||
| ) | ||
| ] | ||
Uh oh!
There was an error while loading. Please reload this page.