ワンクリックで
tracy
Set up and use Tracy profiler for MLX Vulkan backend profiling
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Set up and use Tracy profiler for MLX Vulkan backend profiling
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Run and compare MLX Vulkan inference benchmarks. Use when asked to benchmark this repository, measure a change, run bf16 or 8-bit MLX performance tests, or compare current results with the README baseline.
Review the MLX Vulkan backend for one major async-pipeline or inference-performance issue, obtain user approval, implement the scoped fix, then run full MLX validation, benchmarks, and model generation reporting. Use when the user wants an end-to-end Vulkan improvement workflow with an explicit review-before-fix approval boundary.
Commit changes solely within the MLX submodule in this Vulkan repository. Use when asked to inspect, stage, and commit work in `mlx/` without modifying or committing the `mlx-vulkan` parent repository.
Commit MLX submodule changes, run required Vulkan benchmarks, push a branch, and open a PR against `goniz/mlx`. Use when asked to create a pull request for MLX Vulkan work, especially when an issue number must be closed and bf16 plus 8-bit benchmark results are required.
Build MLX, reproduce one failing C++ test, and implement the smallest Vulkan-only fix. Use when asked to repair a C++ test failure in this repository while preserving test code and avoiding unrelated fixes.
Build MLX, reproduce one failing Python test, and implement the smallest Vulkan-only fix. Use when asked to repair a Python test failure in this repository while preserving test code and avoiding unrelated fixes.
SOC 職業分類に基づく
| name | tracy |
| description | Set up and use Tracy profiler for MLX Vulkan backend profiling |
Use this skill when you need to add, enable, or analyze Tracy profiling in a native C++ project, especially an MLX backend or Vulkan-heavy codebase. The goal is to get from “no profiling” to actionable traces with minimal nonsense and minimal hot-path damage.
This skill is grounded in the Tracy user manual quick-start and feature documentation. Tracy integration requires adding TracyClient.cpp, including tracy/Tracy.hpp, defining TRACY_ENABLE project-wide, and instrumenting code with macros such as ZoneScoped and FrameMark. Tracy also supports GPU profiling, memory profiling, plots, message logs, and call stacks. fileciteturn1file0
Use this skill when the user asks to:
Do not use this skill when:
TracyClient.cpp, include tracy/Tracy.hpp, define TRACY_ENABLE, place ZoneScoped in functions of interest, and place FrameMark at frame boundaries. fileciteturn1file0profiler directory with CMake. fileciteturn1file7TracyPlot, messages via TracyMessage, memory events via TracyAlloc / TracyFree, and GPU profiling including Vulkan. fileciteturn1file5Preferred options:
third_party/tracyFetchContentMinimal source integration:
TracyClient.cpptracy/publictracy/Tracy.hpp where instrumentation is usedTRACY_ENABLE for the whole target or build configuration intended for profiling fileciteturn1file0For CMake-based native projects, do one of these:
option(TRACY_ENABLE "Enable Tracy profiler" ON)
add_subdirectory(third_party/tracy)
target_link_libraries(my_target PRIVATE Tracy::TracyClient)
target_compile_definitions(my_target PRIVATE TRACY_ENABLE)
include(FetchContent)
option(TRACY_ENABLE "Enable Tracy profiler" ON)
FetchContent_Declare(
tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG master
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(tracy)
target_link_libraries(my_target PRIVATE Tracy::TracyClient)
target_compile_definitions(my_target PRIVATE TRACY_ENABLE)
Start embarrassingly small:
#include <tracy/Tracy.hpp>
void run_graph(Graph& g) {
ZoneScoped;
// work
}
For thread entry points:
void worker_thread_main() {
tracy::SetThreadName("mlx-vk-worker");
ZoneScoped;
// loop
}
For frame-like iterations or benchmark iterations:
void render_or_step() {
ZoneScoped;
// work
FrameMark;
}
ZoneScoped records scope timing plus source location metadata, while FrameMark establishes frame boundaries for the frame profiler. fileciteturn1file0 fileciteturn1file9
Use these when the trace starts looking like spaghetti thrown into a server rack:
ZoneScopedN("encode_command_buffer");
ZoneText(cmd_name.c_str(), cmd_name.size());
ZoneValue(batch_size);
Useful macros include:
ZoneScopedN(name) for stable custom labelsZoneText(text, size) for dynamic contextZoneValue(uint64_t) for numeric contextZoneScopedC(color) / ZoneColor(color) for visual grouping fileciteturn1file9For queue depth, bytes uploaded, command buffers submitted, descriptor set pressure, split-k count, and similar bread-and-butter signals:
TracyPlot("vk.pending_submissions", pending_submissions);
TracyPlot("vk.bytes_uploaded", static_cast<int64_t>(bytes_uploaded));
TracyMessageL("transfer queue stalled");
You can configure plot presentation with TracyPlotConfig(name, format, step, fill, color). Tracy supports number, memory, and percentage plot formats. fileciteturn1file5
Wrap custom allocators or strategic allocation sites:
void* p = allocate(sz);
TracyAlloc(p, sz);
TracyFree(p);
free(p);
This enables memory graphs, leak visibility, active-allocation rewind, and memory hot-spot analysis. fileciteturn1file5
Tracy supports Vulkan GPU profiling. Use it for command-buffer spans, dispatch batches, copy/upload passes, and queue submission analysis. The exact Vulkan API wrappers/macros are documented in the Tracy manual’s GPU profiling section. fileciteturn1file1
Recommended pattern for an MLX Vulkan backend:
Suggested first-pass zone map for MLX Vulkan:
compile_pipelineallocate_descriptor_setsrecord_compute_dispatchrecord_buffer_uploadqueue_submit_computequeue_submit_transferwait_for_fencesync_buffersgraph_executekernel::<op_name>The manual states the profiler/analyzer is built separately with CMake, for example:
cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release
cmake --build profiler/build --config Release --parallel
The analyzer can connect to localhost or remote clients. Tracy recommends using matching client/server versions because protocol changes between releases can break connections. fileciteturn1file7
Basic loop:
Tracy can also be used in interactive or command-line capture flows, and the manual has dedicated sections for capture and later analysis. fileciteturn1file1
TRACY_ENABLE is defined and the analyzer version matches the client version. fileciteturn1file7#include <tracy/Tracy.hpp> is present and ZoneScoped is actually executed. fileciteturn1file0TracyClient.cpp is compiled exactly once in the target graph. The manual covers initial setup and CMake integration. fileciteturn1file0FrameMark for logical iterations such as benchmark steps or inference requests. fileciteturn1file0When using this skill, produce:
Use this structure when helping the user:
Primary source: Tracy Profiler user manual, including quick-start, build, instrumentation, plots, memory profiling, and GPU profiling sections. fileciteturn1file0