How rocm/tensile works
This project is Tensile – a highly complex, benchmark‐driven backend generator for GEMM and related tensor contraction libraries, developed primarily as the performance engine for rocBLAS on AMD GPUs. Its purpose is to create optimized GPU kernels tailored for matrix multiplications, batched GEMMs, and multi-dimensional tensor contractions via a vast, configurable solution and tuning infrastructure.
a. Core Engine & Library Generator:
• This includes the main “Tensile” Python modules (e.g., Tensile.py, TensileCreateLibrary.py, TensileMergeLibrary.py), which gather problem definitions, tuning configurations, and custom kernels.
• It processes configuration files from the Tensile/Configs and tuning directories.
b. Configuration and Tuning Subsystem:
• Tuning automation scripts in the tuning/automation folder that analyze performance and adjust configuration parameters.
c. Kernel Generation & Customization Layers:
• Components such as the BuildCommands modules (located under Tensile/BuildCommands) and KernelWriter modules (KernelWriterAssembly.py, KernelWriterSource.py, etc.) that generate assembly or HIP source code for the GPU.
• CustomKernels and EmbeddedData components which allow for specialized or user-defined kernels.
d. Testing and Validation:
• Extensive HostLibraryTests, unit tests (Tensile/Tests/unit), integration tests, and pre_checkin tests. This branch shows how automatically generated libraries are validated against expected solutions.
e. External Interfaces and Deployment:
• Peripheral components such as the “docker”, “docs”, and “cmake” directories, which support building, deployment, and documentation.
Interactions and Data Flows
• From the core engine, show flows into the Kernel Generation layer (via the KernelWriter and BuildCommands modules) that produces GPU kernel source files.
• Then, indicate the output library (and intermediate products, e.g., “embedded” or “merged” libraries) that integrate with rocBLAS.
• Feedback loops from the testing suites to the core engine—for example, performance or correctness results that can drive further tuning.
Architectural Patterns & Design Aesthetics
– Another (e.g., orange) for kernel writing and generation modules.
– Yet another (e.g., purple) for testing and validation.