1 /*
  2  * Copyright (c) 2024, 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 // Auto generated from  hat.backend.ffi.Config
 27 // Auto generated from  hat.backend.ffi.Config
 28 // Auto generated from  hat.backend.ffi.Config
 29 #pragma once
 30 
 31 #include <iostream>
 32 
 33 
 34 struct BasicConfig{
 35     static constexpr int START_BIT_IDX                    = 0x10;
 36     static constexpr int MINIMIZE_COPIES_BIT              = 1<<0x10;
 37     static constexpr int TRACE_BIT                        = 1<<0x11;
 38     static constexpr int PROFILE_BIT                      = 1<<0x12;
 39     static constexpr int SHOW_CODE_BIT                    = 1<<0x13;
 40     static constexpr int SHOW_KERNEL_MODEL_BIT            = 1<<0x14;
 41     static constexpr int SHOW_COMPUTE_MODEL_BIT           = 1<<0x15;
 42     static constexpr int INFO_BIT                         = 1<<0x16;
 43     static constexpr int TRACE_COPIES_BIT                 = 1<<0x17;
 44     static constexpr int TRACE_SKIPPED_COPIES_BIT         = 1<<0x18;
 45     static constexpr int TRACE_ENQUEUES_BIT               = 1<<0x19;
 46     static constexpr int TRACE_CALLS_BIT                  = 1<<0x1a;
 47     static constexpr int SHOW_WHY_BIT                     = 1<<0x1b;
 48     static constexpr int SHOW_STATE_BIT                   = 1<<0x1c;
 49     static constexpr int PTX_BIT                          = 1<<0x1d;
 50     static constexpr int INTERPRET_BIT                    = 1<<0x1e;
 51     static constexpr int END_BIT_IDX                      = 0x1f;
 52     const static char *bitNames[]; // See below for initialization
 53     int configBits;
 54     bool minimizeCopies;
 55     bool trace;
 56     bool profile;
 57     bool showCode;
 58     bool showKernelModel;
 59     bool showComputeModel;
 60     bool info;
 61     bool traceCopies;
 62     bool traceSkippedCopies;
 63     bool traceEnqueues;
 64     bool traceCalls;
 65     bool showWhy;
 66     bool showState;
 67     bool ptx;
 68     bool interpret;
 69     int platform;
 70     int device;
 71     bool alwaysCopy;
 72     explicit BasicConfig(int configBits):
 73         configBits(configBits),
 74         minimizeCopies((configBits & MINIMIZE_COPIES_BIT)==MINIMIZE_COPIES_BIT),
 75         trace((configBits & TRACE_BIT)==TRACE_BIT),
 76         profile((configBits & PROFILE_BIT)==PROFILE_BIT),
 77         showCode((configBits & SHOW_CODE_BIT)==SHOW_CODE_BIT),
 78         showKernelModel((configBits & SHOW_KERNEL_MODEL_BIT)==SHOW_KERNEL_MODEL_BIT),
 79         showComputeModel((configBits & SHOW_COMPUTE_MODEL_BIT)==SHOW_COMPUTE_MODEL_BIT),
 80         info((configBits & INFO_BIT)==INFO_BIT),
 81         traceCopies((configBits & TRACE_COPIES_BIT)==TRACE_COPIES_BIT),
 82         traceSkippedCopies((configBits & TRACE_SKIPPED_COPIES_BIT)==TRACE_SKIPPED_COPIES_BIT),
 83         traceEnqueues((configBits & TRACE_ENQUEUES_BIT)==TRACE_ENQUEUES_BIT),
 84         traceCalls((configBits & TRACE_CALLS_BIT)==TRACE_CALLS_BIT),
 85         showWhy((configBits & SHOW_WHY_BIT)==SHOW_WHY_BIT),
 86         showState((configBits & SHOW_STATE_BIT)==SHOW_STATE_BIT),
 87         ptx((configBits & PTX_BIT)==PTX_BIT),
 88         interpret((configBits & INTERPRET_BIT)==INTERPRET_BIT),
 89         platform(configBits & 0xf),
 90         alwaysCopy(!minimizeCopies),
 91         device((configBits & 0xf0) >> 4){
 92             if(info){
 93                 std::cout << "native minimizeCopies " << minimizeCopies << std::endl;
 94                 std::cout << "native trace " << trace << std::endl;
 95                 std::cout << "native profile " << profile << std::endl;
 96                 std::cout << "native showCode " << showCode << std::endl;
 97                 std::cout << "native showKernelModel " << showKernelModel << std::endl;
 98                 std::cout << "native showComputeModel " << showComputeModel << std::endl;
 99                 std::cout << "native info " << info << std::endl;
100                 std::cout << "native traceCopies " << traceCopies << std::endl;
101                 std::cout << "native traceSkippedCopies " << traceSkippedCopies << std::endl;
102                 std::cout << "native traceEnqueues " << traceEnqueues << std::endl;
103                 std::cout << "native traceCalls " << traceCalls << std::endl;
104                 std::cout << "native showWhy " << showWhy << std::endl;
105                 std::cout << "native showState " << showState << std::endl;
106                 std::cout << "native ptx " << ptx << std::endl;
107                 std::cout << "native interpret " << interpret << std::endl;
108 
109             }
110         }
111 
112     virtual ~BasicConfig()= default;
113 };
114 
115 #ifdef shared_cpp
116 const char *BasicConfig::bitNames[]={
117     "MINIMIZE_COPIES_BIT",
118     "TRACE_BIT",
119     "PROFILE_BIT",
120     "SHOW_CODE_BIT",
121     "SHOW_KERNEL_MODEL_BIT",
122     "SHOW_COMPUTE_MODEL_BIT",
123     "INFO_BIT",
124     "TRACE_COPIES_BIT",
125     "TRACE_SKIPPED_COPIES_BIT",
126     "TRACE_ENQUEUES_BIT",
127     "TRACE_CALLS_BIT",
128     "SHOW_WHY_BIT",
129     "SHOW_STATE_BIT",
130     "PTX_BIT",
131     "INTERPRET_BIT",
132 };
133 #endif