Sync zDNN branch lineage#23799
Open
jrepp wants to merge 28 commits into
Open
Conversation
- MUL_MAT requires PARMBLKFORMAT_1 (z16+) for zdnn_matmul_transpose_op - GELU requires NNPA function code 53 (z16+) - Add runtime check and clear error message for z15 users - Operations will fall back to CPU on z15 instead of crashing This allows the zDNN backend to work on z15 with reduced functionality, while fully utilizing z16+ capabilities when available.
Integer types (I8, I32) cannot be transformed by zDNN and should not be marked as native types. Only F32, F16, and BF16 can be transformed and used with NNPA operations. Also removes Q8_0 from native types - it's a quantized type that should be dequantized to F32 rather than treated as native INT8. This fixes crashes when running models that use integer indices for operations like embedding lookups (GET_ROWS).
The IBM zDNN library requires output tensors to be reset via zdnn_reset_ztensor() before writing if they're already transformed. Without this reset, operations like zdnn_rmsnorm return ZDNN_INVALID_STATE. This fixes the error: "ZDNN_INVALID_STATE: Attempted to transform data into a tensor that is already transformed" Added reset calls before all operations that write to destination tensors: - elementwise.cpp: add, mul, sub, div, softmax, rms_norm - unary.cpp: gelu, relu, tanh, sigmoid, exp, neg, sqrt, log, silu, leaky_relu - mmf.cpp: matmul_transpose_op
Add init_raw_ztensor helper to create lightweight ztensor wrappers for raw data operations (get_rows, rope). These wrappers provide type safety while avoiding memory allocation overhead. Updated functions: - ggml_zdnn_get_rows: Uses ztensor wrappers for embedding lookup - ggml_zdnn_rope: Uses ztensor wrappers for rotary position embedding
- MUL_MAT requires PARMBLKFORMAT_1 (z16+) for zdnn_matmul_transpose_op - GELU requires NNPA function code 53 (z16+) - Add runtime check and clear error message for z15 users - Operations will fall back to CPU on z15 instead of crashing This allows the zDNN backend to work on z15 with reduced functionality, while fully utilizing z16+ capabilities when available.
Integer types (I8, I32) cannot be transformed by zDNN and should not be marked as native types. Only F32, F16, and BF16 can be transformed and used with NNPA operations. Also removes Q8_0 from native types - it's a quantized type that should be dequantized to F32 rather than treated as native INT8. This fixes crashes when running models that use integer indices for operations like embedding lookups (GET_ROWS).
The IBM zDNN library requires output tensors to be reset via zdnn_reset_ztensor() before writing if they're already transformed. Without this reset, operations like zdnn_rmsnorm return ZDNN_INVALID_STATE. This fixes the error: "ZDNN_INVALID_STATE: Attempted to transform data into a tensor that is already transformed" Added reset calls before all operations that write to destination tensors: - elementwise.cpp: add, mul, sub, div, softmax, rms_norm - unary.cpp: gelu, relu, tanh, sigmoid, exp, neg, sqrt, log, silu, leaky_relu - mmf.cpp: matmul_transpose_op
Add init_raw_ztensor helper to create lightweight ztensor wrappers for raw data operations (get_rows, rope). These wrappers provide type safety while avoiding memory allocation overhead. Updated functions: - ggml_zdnn_get_rows: Uses ztensor wrappers for embedding lookup - ggml_zdnn_rope: Uses ztensor wrappers for rotary position embedding
|
Hi @jrepp, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
Member
|
Thanks for contributing to the IBM zDNN backend. There are a lot of changes here and would take time to review. Can you also include the following details in your PR description?
|
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
Testing