| 38 | #endif |
| 39 | |
| 40 | WeightFormat get_weight_format(const KernelWeightFormat kwf, size_t element_size) { |
| 41 | if (kwf==KernelWeightFormat::NON_FIXED) { |
| 42 | return WeightFormat::UNSPECIFIED; |
| 43 | } |
| 44 | |
| 45 | uint32_t kwf_i = static_cast<uint32_t>(kwf); |
| 46 | uint32_t wf_i = 0; |
| 47 | |
| 48 | const auto block_bytes = (kwf_i >> 8) & 0xf; |
| 49 | const auto vector_count = (kwf_i >> 12) & 0xf; |
| 50 | |
| 51 | uint32_t vector_bytes; |
| 52 | |
| 53 | // For fast mode BF16 kernels set the appropriate bit and override element size to 2. |
| 54 | if (kwf_i & 0x10) { |
| 55 | element_size = 2; |
| 56 | wf_i |= 0x10; |
| 57 | } |
| 58 | |
| 59 | // Get total bytes in vector output. Populate with NEON default, then |
| 60 | // override with SVE if it is an SVE format (AArch64 only). |
| 61 | vector_bytes = vector_count * 16; |
| 62 | |
| 63 | #ifdef __aarch64__ |
| 64 | if (kwf_i & 0x1) { |
| 65 | vector_bytes = vector_count * get_vector_length<uint8_t>(); |
| 66 | } |
| 67 | #endif |
| 68 | |
| 69 | auto input_blocking = block_bytes / element_size; |
| 70 | auto output_blocking = vector_bytes / block_bytes; |
| 71 | |
| 72 | wf_i |= (input_blocking << 20); |
| 73 | wf_i |= (output_blocking << 8); |
| 74 | |
| 75 | return static_cast<WeightFormat>(wf_i); |
| 76 | } |
| 77 | |
| 78 | } // namespace arm_gemm |
| 79 |
no outgoing calls
no test coverage detected