@@ -511,6 +511,19 @@ def format_of(ty):
511511#include <stdio.h>
512512#include <numpy/arrayobject.h>
513513
514+ namespace {{
515+
516+ bool getBoolEnv(const std::string &env) {{
517+ const char *s = std::getenv(env.c_str());
518+ std::string str(s ? s : "");
519+ std::transform(str.begin(), str.end(), str.begin(),
520+ [](unsigned char c) {{ return std::tolower(c); }});
521+ return (str == "on" || str == "true" || str == "1");
522+ }}
523+
524+ }}
525+
526+
514527static inline void gpuAssert(ze_result_t code, const char *file, int line)
515528{{
516529 if (code != ZE_RESULT_SUCCESS)
@@ -616,6 +629,27 @@ def format_of(ty):
616629 if (shared_memory) {{
617630 expected_num_params -= 1;
618631 }}
632+
633+ static bool launchDebug = getBoolEnv("TRITON_INTEL_LAUNCH_DEBUG");
634+ if (launchDebug){{
635+ std::cout << "kernel info name:" << kernel_name << " @" << &kernel_ptr << std::endl;
636+ std::cout << "kernel info attributes:" << kernel_ptr.get_info<sycl::info::kernel::attributes>() << std::endl;
637+ std::cout << "kernel info reference_count:" << kernel_ptr.get_info<sycl::info::kernel::reference_count>() << std::endl;
638+ std::cout << "kernel info num_args:" << kernel_ptr.get_info<sycl::info::kernel::num_args>() << std::endl;
639+
640+ std::cout << "launch num param:" << num_params << std::endl;
641+ std::cout << " gridx: " << gridX << std::endl;
642+ std::cout << " gridY: " << gridY << std::endl;
643+ std::cout << " gridZ: " << gridZ << std::endl;
644+ std::cout << " num_warps: " << num_warps << std::endl;
645+ std::cout << " threads_per_warp: " << threads_per_warp << std::endl;
646+ std::cout << " global range:[" << "x:"<< global_range_x << ", y:" << global_range_y << ", z:" << global_range_z << "]" << std::endl;
647+ std::cout << " local range:[" << "x:"<< local_range_x << ", y:" << local_range_y << ", z:" << local_range_z << "]" << std::endl;
648+ std::cout << " shared_memory: " << shared_memory << std::endl;
649+
650+ // param
651+ { " " .join (f'std::cout << " param { idx } :" << *({ ty_to_cpp (item )} *)params[{ idx } ] << std::endl;' for idx , item in enumerate ([signature [i ] for i in signature if signature [i ] != "constexpr" ]))}
652+ }}
619653 assert(num_params == expected_num_params && "number of kernel param not matched");
620654 // Submit the imported kernel.
621655 auto cgf = [&](sycl::handler &cgh) {{
0 commit comments