From 8ad7f1b2ca3f4c72fbf721193044c5ee93c26510 Mon Sep 17 00:00:00 2001 From: rahjain-amd Date: Fri, 26 Sep 2025 21:35:35 +0530 Subject: [PATCH] Disable Rapid Json to be used by Default (#2936) To enable the json dump we can now build with -DCK_ENABLE_JSON_DUMP=1 [ROCm/composable_kernel commit: e92e69318e233b57d1a98c59174c81db2f793327] --- CMakeLists.txt | 6 ++++++ include/ck_tile/utility/json_dump.hpp | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26d91fe6d8..88b8f05200 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -339,6 +339,7 @@ endif() option(USE_BITINT_EXTENSION_INT4 "Whether to enable clang's BitInt extension to provide int4 data type." OFF) option(USE_OPT_GFX11 "Whether to enable LDS cumode and Wavefront32 mode for GFX11 silicons." OFF) option(ENABLE_ASM_DUMP "Whether to enable assembly dump for kernels." OFF) +option(ENABLE_JSON_DUMP "Whether to enable json dump for examples." OFF) if(USE_BITINT_EXTENSION_INT4) add_compile_definitions(CK_EXPERIMENTAL_BIT_INT_EXTENSION_INT4) @@ -352,6 +353,11 @@ if(ENABLE_ASM_DUMP) message("CK compiled with ENABLE_ASM_DUMP set to ${ENABLE_ASM_DUMP}") endif() +if (ENABLE_JSON_DUMP) + add_compile_definitions(CK_ENABLE_JSON_DUMP) + message("CK compiled with ENABLE_JSON_DUMP set to ${ENABLE_JSON_DUMP}") +endif() + ## Threads set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) diff --git a/include/ck_tile/utility/json_dump.hpp b/include/ck_tile/utility/json_dump.hpp index d7c96d77b8..26af906ed0 100644 --- a/include/ck_tile/utility/json_dump.hpp +++ b/include/ck_tile/utility/json_dump.hpp @@ -1,10 +1,10 @@ +#ifdef CK_ENABLE_JSON_DUMP #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/document.h" #include "rapidjson/rapidjson.h" -// #include #pragma GCC diagnostic pop #define START_JSON_DUMP_FILE(file_name) \ @@ -76,6 +76,18 @@ static void add_perf_to_json(rapidjson::Writer& writer, writer.EndArray(); } +#else +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-local-typedef" +#define START_JSON_DUMP_FILE(file_name) +#define END_JSON_DUMP_FILE() \ + std::cout << "JSON dump disabled, To enable, set CK_ENABLE_JSON_DUMP cmake option" << std::endl; + +#define ADD_KEY_VALUE(key, value) +#define ADD_PERF_TO_JSON(_time, tflops, gbytes) +#endif + // Helper traits to check for static member existence template struct has_warp_tile_members : std::false_type @@ -698,3 +710,7 @@ void dump_fmha_bwd_json_results(const std::string& json_filename, ADD_PERF_TO_JSON(ave_time, tflops, gb_per_sec) END_JSON_DUMP_FILE(); } + +#ifndef CK_ENABLE_JSON_DUMP +#pragma GCC diagnostic pop +#endif