Skip to content

Commit

Permalink
debug - truncate jit output
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Oct 21, 2024
1 parent 1dc8b1e commit 2f8ba40
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 27 deletions.
3 changes: 0 additions & 3 deletions backends/cuda-gen/ceed-cuda-gen-operator-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,6 @@ extern "C" int CeedOperatorBuildKernel_Cuda_gen(CeedOperator op) {
code << "// -----------------------------------------------------------------------------\n\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated Operator Kernels:\n");
CeedDebug(ceed, code.str().c_str());

CeedCallBackend(CeedCompile_Cuda(ceed, code.str().c_str(), &data->module, 1, "T_1D", CeedIntMax(Q_1d, data->max_P_1d)));
CeedCallBackend(CeedGetKernel_Cuda(ceed, data->module, operator_name.c_str(), &data->op));

Expand Down
4 changes: 0 additions & 4 deletions backends/cuda-ref/ceed-cuda-ref-qfunction-load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ extern "C" int CeedQFunctionBuildKernel_Cuda_ref(CeedQFunction qf) {
code << " }\n";
code << "}\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated QFunction Kernels:\n");
CeedDebug(ceed, code.str().c_str());

// Compile kernel
CeedCallBackend(CeedCompile_Cuda(ceed, code.str().c_str(), &data->module, 0));
CeedCallBackend(CeedGetKernel_Cuda(ceed, data->module, kernel_name.c_str(), &data->QFunction));
Expand Down
6 changes: 3 additions & 3 deletions backends/cuda/ceed-cuda-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
CeedCallNvrtc(ceed, nvrtcCreateProgram(&prog, code.str().c_str(), NULL, 0, NULL, NULL));

// Compile kernel
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- ATTEMPING TO COMPILE JIT SOURCE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- END OF JIT SOURCE ----------\n");
nvrtcResult result = nvrtcCompileProgram(prog, num_opts + num_jit_source_dirs, opts);

for (CeedInt i = 0; i < num_jit_source_dirs; i++) {
Expand All @@ -116,9 +119,6 @@ int CeedCompile_Cuda(Ceed ceed, const char *source, CUmodule *module, const Ceed
char *log;
size_t log_size;

CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedCallNvrtc(ceed, nvrtcGetProgramLogSize(prog, &log_size));
CeedCallBackend(CeedMalloc(log_size, &log));
CeedCallNvrtc(ceed, nvrtcGetProgramLog(prog, log));
Expand Down
4 changes: 0 additions & 4 deletions backends/hip-gen/ceed-hip-gen-operator-build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,10 +896,6 @@ extern "C" int CeedOperatorBuildKernel_Hip_gen(CeedOperator op) {
code << "}\n";
code << "// -----------------------------------------------------------------------------\n\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated Operator Kernels:\n");
CeedDebug(ceed, code.str().c_str());

CeedInt block_sizes[3] = {0, 0, 0};
CeedInt num_elem;

Expand Down
4 changes: 0 additions & 4 deletions backends/hip-ref/ceed-hip-ref-qfunction-load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ extern "C" int CeedQFunctionBuildKernel_Hip_ref(CeedQFunction qf) {
code << " }\n";
code << "}\n";

// View kernel for debugging
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Generated QFunction Kernels:\n");
CeedDebug(ceed, code.str().c_str());

// Compile kernel
CeedCallBackend(CeedCompile_Hip(ceed, code.str().c_str(), &data->module, 1, "BLOCK_SIZE", ceed_Hip->opt_block_size));
CeedCallBackend(CeedGetKernel_Hip(ceed, data->module, kernel_name.c_str(), &data->QFunction));
Expand Down
7 changes: 3 additions & 4 deletions backends/hip-ref/ceed-hip-ref-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,11 @@ static inline int CeedElemRestrictionSetupCompile_Hip(CeedElemRestriction rstr)
"// AtPoints restriction source\n#include <ceed/jit-source/hip/hip-ref-restriction-at-points.h>\n\n"
"// Standard restriction source\n#include <ceed/jit-source/hip/hip-ref-restriction-offset.h>\n";

CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "----- Loading Restriction Kernel Source Complete! -----\n");
CeedCallBackend(CeedCompile_Hip(ceed, restriction_kernel_source, &impl->module, 6, "RSTR_ELEM_SIZE", elem_size, "RSTR_NUM_ELEM", num_elem,
] CeedCallBackend(CeedCompile_Hip(ceed, restriction_kernel_source, &impl->module, 6, "RSTR_ELEM_SIZE", elem_size, "RSTR_NUM_ELEM", num_elem,
"RSTR_NUM_COMP", num_comp, "RSTR_NUM_NODES", impl->num_nodes, "RSTR_COMP_STRIDE", comp_stride,
"USE_DETERMINISTIC", is_deterministic ? 1 : 0));
CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "OffsetNoTranspose", &impl->ApplyNoTranspose));
CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "AtPointsTranspose", &impl->ApplyTranspose));
CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "OffsetNoTranspose", &impl->ApplyNoTranspose));
CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "AtPointsTranspose", &impl->ApplyTranspose));
} break;
case CEED_RESTRICTION_ORIENTED: {
const char restriction_kernel_source[] =
Expand Down
6 changes: 3 additions & 3 deletions backends/hip/ceed-hip-compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
code << source;

// Create Program
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- ATTEMPING TO COMPILE JIT SOURCE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- END OF JIT SOURCE ----------\n");
CeedCallHiprtc(ceed, hiprtcCreateProgram(&prog, code.str().c_str(), NULL, 0, NULL, NULL));

// Compile kernel
Expand All @@ -118,9 +121,6 @@ int CeedCompile_Hip(Ceed ceed, const char *source, hipModule_t *module, const Ce
size_t log_size;
char *log;

CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedDebug(ceed, "Source:\n%s\n", code.str().c_str());
CeedDebug256(ceed, CEED_DEBUG_COLOR_ERROR, "---------- CEED JIT SOURCE FAILED TO COMPILE ----------\n");
CeedChk_hiprtc(ceed, hiprtcGetProgramLogSize(prog, &log_size));
CeedCallBackend(CeedMalloc(log_size, &log));
CeedCallHiprtc(ceed, hiprtcGetProgramLog(prog, log));
Expand Down
2 changes: 0 additions & 2 deletions interface/ceed-jit-tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ int CeedLoadSourceToInitializedBuffer(Ceed ceed, const char *source_file_path, C
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "---------- Ceed JiT ----------\n");
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Current source file: ");
CeedDebug(ceed, "%s\n", source_file_path);
CeedDebug256(ceed, CEED_DEBUG_COLOR_SUCCESS, "Current buffer:\n");
CeedDebug(ceed, "%s\n", *buffer);

// Read file to temporary buffer
source_file = fopen(source_file_path, "rb");
Expand Down

0 comments on commit 2f8ba40

Please sign in to comment.