1 /* 2 * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 /* 26 You probably should not edit this this file!!! 27 It was auto generated 2025-10-02 14:07:12.618 by hat.FFIConfigCreator 28 */ 29 #pragma once 30 31 #include <iostream> 32 33 34 struct BasicConfig{ 35 static constexpr int MINIMIZE_COPIES_BIT = 1<<0x8; 36 static constexpr int TRACE_BIT = 1<<0x9; 37 static constexpr int PROFILE_BIT = 1<<0xa; 38 static constexpr int SHOW_CODE_BIT = 1<<0xb; 39 static constexpr int SHOW_KERNEL_MODEL_BIT = 1<<0xc; 40 static constexpr int SHOW_COMPUTE_MODEL_BIT = 1<<0xd; 41 static constexpr int INFO_BIT = 1<<0xe; 42 static constexpr int TRACE_COPIES_BIT = 1<<0xf; 43 static constexpr int TRACE_SKIPPED_COPIES_BIT = 1<<0x10; 44 static constexpr int TRACE_ENQUEUES_BIT = 1<<0x11; 45 static constexpr int TRACE_CALLS_BIT = 1<<0x12; 46 static constexpr int SHOW_WHY_BIT = 1<<0x13; 47 static constexpr int SHOW_STATE_BIT = 1<<0x14; 48 static constexpr int PTX_BIT = 1<<0x15; 49 static constexpr int INTERPRET_BIT = 1<<0x16; 50 static constexpr int NO_BUFFER_TAGGING_BIT = 1<<0x17; 51 static constexpr int NO_DIALECT_BIT = 1<<0x18; 52 static constexpr int NO_MODULE_OP_BIT = 1<<0x19; 53 static constexpr int HEADLESS_BIT = 1<<0x1a; 54 const static char *bitNames[]; // See below for initialization 55 const static char *bitDescriptions[]; // See below for initialization 56 int configBits; 57 bool minimizeCopies; 58 bool trace; 59 bool profile; 60 bool showCode; 61 bool showKernelModel; 62 bool showComputeModel; 63 bool info; 64 bool traceCopies; 65 bool traceSkippedCopies; 66 bool traceEnqueues; 67 bool traceCalls; 68 bool showWhy; 69 bool showState; 70 bool ptx; 71 bool interpret; 72 bool noBufferTagging; 73 bool noDialect; 74 bool noModuleOp; 75 bool headless; 76 int platform; 77 int device; 78 bool alwaysCopy; 79 explicit BasicConfig(int configBits): 80 configBits(configBits), 81 minimizeCopies((configBits & MINIMIZE_COPIES_BIT)==MINIMIZE_COPIES_BIT), 82 trace((configBits & TRACE_BIT)==TRACE_BIT), 83 profile((configBits & PROFILE_BIT)==PROFILE_BIT), 84 showCode((configBits & SHOW_CODE_BIT)==SHOW_CODE_BIT), 85 showKernelModel((configBits & SHOW_KERNEL_MODEL_BIT)==SHOW_KERNEL_MODEL_BIT), 86 showComputeModel((configBits & SHOW_COMPUTE_MODEL_BIT)==SHOW_COMPUTE_MODEL_BIT), 87 info((configBits & INFO_BIT)==INFO_BIT), 88 traceCopies((configBits & TRACE_COPIES_BIT)==TRACE_COPIES_BIT), 89 traceSkippedCopies((configBits & TRACE_SKIPPED_COPIES_BIT)==TRACE_SKIPPED_COPIES_BIT), 90 traceEnqueues((configBits & TRACE_ENQUEUES_BIT)==TRACE_ENQUEUES_BIT), 91 traceCalls((configBits & TRACE_CALLS_BIT)==TRACE_CALLS_BIT), 92 showWhy((configBits & SHOW_WHY_BIT)==SHOW_WHY_BIT), 93 showState((configBits & SHOW_STATE_BIT)==SHOW_STATE_BIT), 94 ptx((configBits & PTX_BIT)==PTX_BIT), 95 interpret((configBits & INTERPRET_BIT)==INTERPRET_BIT), 96 noBufferTagging((configBits & NO_BUFFER_TAGGING_BIT)==NO_BUFFER_TAGGING_BIT), 97 noDialect((configBits & NO_DIALECT_BIT)==NO_DIALECT_BIT), 98 noModuleOp((configBits & NO_MODULE_OP_BIT)==NO_MODULE_OP_BIT), 99 headless((configBits & HEADLESS_BIT)==HEADLESS_BIT), 100 platform(configBits & 0xf), 101 alwaysCopy(!minimizeCopies), 102 device((configBits & 0xf0) >> 4){ 103 if(info){ 104 std::cout << "native minimizeCopies " << minimizeCopies << std::endl; 105 std::cout << "native trace " << trace << std::endl; 106 std::cout << "native profile " << profile << std::endl; 107 std::cout << "native showCode " << showCode << std::endl; 108 std::cout << "native showKernelModel " << showKernelModel << std::endl; 109 std::cout << "native showComputeModel " << showComputeModel << std::endl; 110 std::cout << "native info " << info << std::endl; 111 std::cout << "native traceCopies " << traceCopies << std::endl; 112 std::cout << "native traceSkippedCopies " << traceSkippedCopies << std::endl; 113 std::cout << "native traceEnqueues " << traceEnqueues << std::endl; 114 std::cout << "native traceCalls " << traceCalls << std::endl; 115 std::cout << "native showWhy " << showWhy << std::endl; 116 std::cout << "native showState " << showState << std::endl; 117 std::cout << "native ptx " << ptx << std::endl; 118 std::cout << "native interpret " << interpret << std::endl; 119 std::cout << "native noBufferTagging " << noBufferTagging << std::endl; 120 std::cout << "native noDialect " << noDialect << std::endl; 121 std::cout << "native noModuleOp " << noModuleOp << std::endl; 122 std::cout << "native headless " << headless << std::endl; 123 std::cout << "native platform " << platform << std::endl; 124 std::cout << "native device " << device << std::endl; 125 } 126 } 127 virtual ~BasicConfig()= default; 128 }; 129 130 #ifdef shared_cpp 131 const char *BasicConfig::bitNames[]={ 132 "MINIMIZE_COPIES_BIT", 133 "TRACE_BIT", 134 "PROFILE_BIT", 135 "SHOW_CODE_BIT", 136 "SHOW_KERNEL_MODEL_BIT", 137 "SHOW_COMPUTE_MODEL_BIT", 138 "INFO_BIT", 139 "TRACE_COPIES_BIT", 140 "TRACE_SKIPPED_COPIES_BIT", 141 "TRACE_ENQUEUES_BIT", 142 "TRACE_CALLS_BIT", 143 "SHOW_WHY_BIT", 144 "SHOW_STATE_BIT", 145 "PTX_BIT", 146 "INTERPRET_BIT", 147 "NO_BUFFER_TAGGING_BIT", 148 "NO_DIALECT_BIT", 149 "NO_MODULE_OP_BIT", 150 "HEADLESS_BIT", 151 }; 152 const char *BasicConfig::bitDescriptions[]={ 153 "FFI ONLY Try to minimize copies", 154 "FFI ONLY trace code", 155 "FFI ONLY Turn on profiling", 156 "Show generated code (PTX/OpenCL/CUDA)", 157 "Show (via OpWriter) Kernel Model", 158 "Show (via OpWriter) Compute Model", 159 "FFI ONLY Show platform and device info", 160 "FFI ONLY trace copies", 161 "FFI ONLY Trace skipped copies (see MINIMIZE_COPIES) ", 162 "FFI ONLY trace enqueued tasks", 163 "FFI ONLY trace calls (enter/leave)", 164 "FFI ONLY show why we decided to copy buffer (H to D)", 165 "Show iface buffer state changes", 166 "FFI (NVIDIA) ONLY pass PTX rather than C99 CUDA code", 167 "Interpret the code model rather than converting to bytecode", 168 "Skip AUTO buffer tagging (rely on annotations)", 169 "Skip generating HAT dialect ops", 170 "Use original callgraph (not using Module Op)", 171 "Don't show UI", 172 }; 173 #endif