Skip to content

Conversation

@tenpercent
Copy link
Contributor

Summary

This PR introduces utility tools for building, testing, and analyzing Composable Kernel. The tools are designed to be LLM-agnostic and can be used with any AI assistant or directly from the command line.

Tools Added

1. ck-docker - Docker Container Management

  • Start/stop ROCm-enabled containers
  • Build targets with CMake + Ninja
  • Run tests with gtest filters
  • Auto-detect GPU targets (gfx950, gfx942, etc.)
  • Per-user, per-branch container naming to avoid conflicts

2. ck-build-analysis - Build Time Profiling

  • Uses Clang's -ftime-trace for compilation analysis
  • Aggregates statistics across multiple trace files
  • Identifies template instantiation bottlenecks
  • Generates detailed Markdown reports with:
    • Compilation phase breakdown
    • Top expensive instantiations
    • Template family analysis
    • Data-driven optimization recommendations
  • Configurable granularity (1µs to 500µs)
  • PEP 723 compliant Python script with auto-dependency management via uv

Key Features

  • LLM-agnostic design - Works with any AI assistant
  • Zero-configuration setup - Automatic dependency installation
  • Comprehensive documentation - README files for all tools
  • Security hardening - Input validation, no command injection
  • Multi-file trace aggregation - Accurate build analysis
  • Jinja2-based report generation - Customizable output

Directory Structure

script/tools/
├── README.md                          # Main overview
├── README_ck-docker.md                # ck-docker documentation
├── README_ck-build-analysis.md        # ck-build-analysis documentation
├── ck-docker                          # Docker orchestration script
├── ck-build-analysis                  # Build analysis orchestration
├── common.sh                          # Shared utilities
├── analyze_build_trace.py             # Python analyzer (PEP 723)
└── templates/
    └── build_analysis_report.md.jinja # Report template

Testing

Verified with:

script/tools/ck-build-analysis example_convnd_fwd_xdl_fp32

Successfully analyzed 39,907 events across 4 files and generated a comprehensive build time report.

Usage

Terminal:

export PATH="$PATH:$PWD/script/tools"
ck-docker start
ck-docker build test_amdgcn_mma
ck-build-analysis example_convnd_fwd_xdl_fp32

With LLM Assistant:
Just ask in natural language:

  • "Start the docker container"
  • "Build and test test_amdgcn_mma"
  • "Analyze build time for example_convnd_fwd_xdl_fp32"

This commit introduces utility tools for building, testing, and analyzing
Composable Kernel. The tools are designed to be LLM-agnostic and can be
used with any AI assistant or directly from the command line.

Tools Added:
============

1. ck-docker - Docker container management
   - Start/stop ROCm-enabled containers
   - Build targets with CMake + Ninja
   - Run tests with gtest filters
   - Auto-detect GPU targets (gfx950, gfx942, etc.)
   - Per-user, per-branch container naming to avoid conflicts

2. ck-build-analysis - Build time profiling
   - Uses Clang's -ftime-trace for compilation analysis
   - Aggregates statistics across multiple trace files
   - Identifies template instantiation bottlenecks
   - Generates detailed Markdown reports with:
     * Compilation phase breakdown
     * Top expensive instantiations
     * Template family analysis
     * Data-driven optimization recommendations
   - Configurable granularity (1µs to 500µs)
   - PEP 723 compliant Python script with auto-dependency management via uv

Key Features:
=============

- LLM-agnostic design (works with any AI assistant)
- Zero-configuration setup with automatic dependency installation
- Comprehensive documentation in script/tools/README*.md
- Security hardening (input validation, no command injection)
- Multi-file trace aggregation for accurate build analysis
- Jinja2-based report generation for customizable output

Implementation:
===============

- script/tools/ck-docker - Main Docker orchestration script
- script/tools/ck-build-analysis - Build analysis orchestration
- script/tools/common.sh - Shared utilities (container mgmt, GPU detection)
- script/tools/analyze_build_trace.py - PEP 723 compliant Python analyzer
- script/tools/templates/ - Jinja2 templates for report generation
- script/tools/README*.md - Comprehensive documentation

Directory Structure:
====================

script/tools/
├── README.md                          # Main overview
├── README_ck-docker.md                # ck-docker documentation
├── README_ck-build-analysis.md        # ck-build-analysis documentation
├── ck-docker                          # Docker orchestration script
├── ck-build-analysis                  # Build analysis orchestration
├── common.sh                          # Shared utilities
├── analyze_build_trace.py             # Python analyzer (PEP 723)
└── templates/
    └── build_analysis_report.md.jinja # Report template

The tools follow Unix philosophy: do one thing well, compose easily,
and work from both CLI and programmatic contexts.
@tenpercent tenpercent force-pushed the tenpercent/script-tools branch from a988d43 to 81c0647 Compare January 15, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants