File: customApi.cpp

package info (click to toggle)
intel-graphics-compiler2 2.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 106,644 kB
  • sloc: cpp: 805,640; lisp: 287,672; ansic: 16,414; python: 3,952; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (539 lines) | stat: -rw-r--r-- 18,309 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
/*========================== begin_copyright_notice ============================

Copyright (C) 2017-2021 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#include "AdaptorCommon/customApi.hpp"
#include <mutex>

#if defined(_WIN32) || defined(_WIN64)
#include "Windows.h"
#include <direct.h>
#include <wtypes.h>
#include <process.h>
#endif

#include "common/debug/Debug.hpp"
#include "common/Stats.hpp"
#include "common/igc_regkeys.hpp"
#include "common/SysUtils.hpp"
#include "common/secure_string.h" // strcpy_s()
#include "Probe/Assertion.h"

#if defined(IGC_DEBUG_VARIABLES)
#include "3d/common/iStdLib/File.h"
#endif


namespace {

#ifndef DRIVER_BUILD_ID
#define DRIVER_BUILD_ID "<undefined>"
#endif

#define _STRINGIFY(x) #x
#define STRINGIFY(x) _STRINGIFY(x)

#if defined(_DEBUG)
#if defined(_INTERNAL)
#define CONFIGURATION DebugInternal
#else
#define CONFIGURATION Debug
#endif
#else
#if defined(_INTERNAL)
#define CONFIGURATION ReleaseInternal
#else
#define CONFIGURATION Release
#endif
#endif

#if defined(_WIN64)
#define BITWIDTH x64
#elif defined(_WIN32)
#define BITWIDTH Win32
#else
#define BITWIDTH Unknown
#endif

// We don't want this static string in the RELEASE builds because it can be discovered using the
// Windows SysInternals Strings tool. We don't want to leak such information. Unfortunately this
// means that RELEASE builds can't be queried for their version information. There is no middle ground.
#if defined(_DEBUG) || defined(_INTERNAL)
static const char g_cBuildInfo[] =
    "BUILD ID: " STRINGIFY(DRIVER_BUILD_ID) ", "
                                            "CONFIGURATION: " STRINGIFY(CONFIGURATION) " " STRINGIFY(BITWIDTH) "\0";
#else
static const char g_cBuildInfo[] = "\0";
#endif

#undef CONFIGURATION

static bool g_debugFlags[static_cast<int>(IGC::Debug::DebugFlag::END)] = {0};

static struct {
  bool dumpODS;
  bool dumpFile;
} g_dumpFlags[static_cast<int>(IGC::Debug::DumpType::END)] = {};

std::string g_shaderCorpusName;
std::string g_shaderOutputFolder;
std::string g_shaderOutputName;

} // namespace

namespace IGC {
namespace Debug {

#if defined(IGC_DEBUG_VARIABLES)

EnumStr IGC_DEBUG_API_CALL str(DebugFlag value) {
#define CASE(x)                                                                                                        \
  case DebugFlag::x:                                                                                                   \
    return STRINGIFY(x)
  switch (value) {
    CASE(DUMPS);
    CASE(DUMP_AFTER_PASSES);
    CASE(DUMP_TO_OUTS);
    CASE(DUMP_TO_OUTPUTDEBUGSTRING);
    CASE(OPTIMIZATION_STATS);
    CASE(TIME_STATS_SUM);
    CASE(TIME_STATS_PER_SHADER);
    CASE(TIME_STATS_COARSE);
    CASE(TIME_STATS_PER_PASS);
    CASE(MEM_STATS);
    CASE(MEM_STATS_DETAIL);
    CASE(SHADER_QUALITY_METRICS);
    CASE(SIMD8_ONLY);
    CASE(SIMD16_ONLY);
    CASE(SIMD32_ONLY);
    CASE(VISA_OUTPUT);
    CASE(VISA_BINARY);
    CASE(VISA_DUMPCOMMONISA);
    CASE(VISA_NOSCHEDULE);
    CASE(VISA_DOTALL);
    CASE(VISA_SLOWPATH);
    CASE(VISA_NOBXMLENCODER);
  default:
    IGC_ASSERT_EXIT_MESSAGE(0, "unknown DebugFlag");
    return "<unknown>";
  }
#undef CASE
}

EnumStr IGC_DEBUG_API_CALL str(DumpType value) {
#define CASE(x)                                                                                                        \
  case DumpType::x:                                                                                                    \
    return STRINGIFY(x)
  switch (value) {
    CASE(ASM_TEXT);
    CASE(ASM_BC);
    CASE(TRANSLATED_IR_TEXT);
    CASE(TRANSLATED_IR_BC);
    CASE(PASS_IR_TEXT);
    CASE(PASS_IR_BC);
    CASE(OptIR_TEXT);
    CASE(OptIR_BC);
    CASE(VISA_TEXT);
    CASE(VISA_BC);
    CASE(GENX_ISA_TEXT);
    CASE(GENX_ISA_BC);
    CASE(LLVM_OPT_STAT_TEXT);
    CASE(TIME_STATS_TEXT);
    CASE(TIME_STATS_CSV);
  default:
    IGC_ASSERT_EXIT_MESSAGE(0, "unknown DumpType");
    return "<unknown>";
  }
#undef CASE
}

EnumStr IGC_DEBUG_API_CALL str(DumpLoc value) {
#define CASE(x)                                                                                                        \
  case DumpLoc::x:                                                                                                     \
    return STRINGIFY(x)
  switch (value) {
    CASE(ODS);
    CASE(FILE);
  default:
    IGC_ASSERT_EXIT_MESSAGE(0, "unknown DumpLoc");
    return "<unknown>";
  }
#undef CASE
}

void IGC_DEBUG_API_CALL SetCompilerOption(OptionFlag flag, debugString s) {
  switch (flag) {
#define DECLARE_IGC_REGKEY(dataType, regkeyName, defaultValue, description, releaseMode)                               \
  case OptionFlag::OPTION_##regkeyName:                                                                                \
    strcpy_s(g_RegKeyList.regkeyName.m_string, sizeof(debugString), s);                                                \
    break;
#include "common/igc_regkeys.h"
#undef DECLARE_IGC_REGKEY
  default:
    break;
  }
}

void IGC_DEBUG_API_CALL SetCompilerOption(OptionFlag flag, int value) {
  switch (flag) {
#define DECLARE_IGC_REGKEY(dataType, regkeyName, defaultValue, description, releaseMode)                               \
  case OptionFlag::OPTION_##regkeyName:                                                                                \
    g_RegKeyList.regkeyName.m_Value = value;                                                                           \
    break;
#include "common/igc_regkeys.h"
#undef DECLARE_IGC_REGKEY
  default:
    break;
  }
}

template <typename dataType, typename RegkeyT>
inline void SetCompilerOptionOpaqueHelper(RegkeyT &regkeyName, const dataType *data) {
  memcpy_s(&regkeyName.m_Value, sizeof(dataType), data, sizeof(dataType));
}

template <typename RegkeyT> inline void SetCompilerOptionOpaqueHelper(RegkeyT &regkeyName, debugString data) {
  strcpy_s(&regkeyName.m_string, sizeof(debugString), data);
}

void IGC_DEBUG_API_CALL SetCompilerOptionOpaque(OptionFlag flag, void *data) {
  switch (flag) {
#define DECLARE_IGC_REGKEY(dataType, regkeyName, defaultValue, description, releaseMode)                               \
  case OptionFlag::OPTION_##regkeyName:                                                                                \
    SetCompilerOptionOpaqueHelper(g_RegKeyList.regkeyName, reinterpret_cast<dataType *>(data));                        \
    break;
#include "common/igc_regkeys.h"
#undef DECLARE_IGC_REGKEY
  default:
    break;
  }
}

extern "C" void IGC_DEBUG_API_CALL SetCompilerOptionValue(const char *flagName, int value) {
  if (!flagName) {
    return;
  }

  SRegKeyVariableMetaData *pRegKeyVariable = (SRegKeyVariableMetaData *)&g_RegKeyList;
  unsigned NUM_REGKEY_ENTRIES = sizeof(SRegKeysList) / sizeof(SRegKeyVariableMetaData);
  for (DWORD i = 0; i < NUM_REGKEY_ENTRIES; i++) {
    const char *name = pRegKeyVariable[i].GetName();

    if (!strcmp(flagName, name)) {
      pRegKeyVariable[i].m_Value = value;
      pRegKeyVariable[i].Set();
      break;
    }
  }
}

extern "C" void IGC_DEBUG_API_CALL SetCompilerOptionString(const char *flagName, debugString s) {
  if (!flagName) {
    return;
  }

  SRegKeyVariableMetaData *pRegKeyVariable = (SRegKeyVariableMetaData *)&g_RegKeyList;
  unsigned NUM_REGKEY_ENTRIES = sizeof(SRegKeysList) / sizeof(SRegKeyVariableMetaData);
  for (DWORD i = 0; i < NUM_REGKEY_ENTRIES; i++) {
    const char *name = pRegKeyVariable[i].GetName();

    if (!strcmp(flagName, name)) {
      strcpy_s(pRegKeyVariable[i].m_string, sizeof(debugString), s);
      pRegKeyVariable[i].Set();
      break;
    }
  }
}

void IGC_DEBUG_API_CALL SetDebugFlag(DebugFlag flag, bool enabled) {
  IGC_ASSERT_EXIT_MESSAGE((0 <= static_cast<int>(flag)), "range sanity check");
  IGC_ASSERT_EXIT_MESSAGE((static_cast<int>(flag) < static_cast<int>(DebugFlag::END)), "range sanity check");

  g_debugFlags[static_cast<int>(flag)] = enabled;
}

bool IGC_DEBUG_API_CALL GetDebugFlag(DebugFlag flag) {
  IGC_ASSERT_EXIT_MESSAGE((0 <= static_cast<int>(flag)), "range sanity check");
  IGC_ASSERT_EXIT_MESSAGE((static_cast<int>(flag) < static_cast<int>(DebugFlag::END)), "range sanity check");

#if defined(_WIN32) || defined(_WIN64)
  // Disable Dump  for OS Applications
  if ((DebugFlag::VISA_OUTPUT == flag) || (DebugFlag::VISA_BINARY == flag) || (DebugFlag::VISA_DUMPCOMMONISA == flag)) {
    if (GetModuleHandleA("dwm.exe") || GetModuleHandleA("explorer.exe")) {
      return false;
    }
  }
#endif
  return g_debugFlags[static_cast<int>(flag)];
}

void IGC_DEBUG_API_CALL SetDumpFlag(DumpType type, DumpLoc loc, bool enabled) {
  IGC_ASSERT_EXIT_MESSAGE((0 <= static_cast<int>(type)), "range sanity check");
  IGC_ASSERT_EXIT_MESSAGE((static_cast<int>(type) < static_cast<int>(DumpType::END)), "range sanity check");

  switch (loc) {
  case DumpLoc::ODS:
    g_dumpFlags[static_cast<int>(type)].dumpODS = enabled;
    break;
  case DumpLoc::FILE:
    g_dumpFlags[static_cast<int>(type)].dumpFile = enabled;
    break;
  default:
    IGC_ASSERT_EXIT_MESSAGE(0, "unreachable");
    break;
  }
}

bool IGC_DEBUG_API_CALL GetDumpFlag(DumpType type, DumpLoc loc) {
  IGC_ASSERT_EXIT_MESSAGE((0 <= static_cast<int>(type)), "range sanity check");
  IGC_ASSERT_EXIT_MESSAGE((static_cast<int>(type) < static_cast<int>(DumpType::END)), "range sanity check");

#if defined(_WIN32) || defined(_WIN64)
  // Disable Dump  for OS Applications
  if (GetModuleHandleA("dwm.exe") || GetModuleHandleA("explorer.exe")) {
    return false;
  }
#endif
  switch (loc) {
  case DumpLoc::ODS:
    return g_dumpFlags[static_cast<int>(type)].dumpODS;
  case DumpLoc::FILE:
    return g_dumpFlags[static_cast<int>(type)].dumpFile;
  default:
    IGC_ASSERT_EXIT_MESSAGE(0, "unreachable");
    return false;
  }
}

void IGC_DEBUG_API_CALL SetShaderCorpusName(CorpusName name) { g_shaderCorpusName = name; }

CorpusName IGC_DEBUG_API_CALL GetShaderCorpusName() { return g_shaderCorpusName.c_str(); }

void IGC_DEBUG_API_CALL SetShaderOutputFolder(OutputFolderName name) { g_shaderOutputFolder = name; }
void IGC_DEBUG_API_CALL SetShaderOutputName(OutputName name) { g_shaderOutputName = name; }

bool needMkDir() {
  return IGC_IS_FLAG_ENABLED(DumpLLVMIR) || IGC_IS_FLAG_ENABLED(EnableCosDump) ||
         IGC_IS_FLAG_ENABLED(EnableVISAOutput) || IGC_IS_FLAG_ENABLED(EnableVISABinary) ||
         IGC_IS_FLAG_ENABLED(EnableVISADumpCommonISA) ||
         GetDebugFlag(DebugFlag::DUMP_AFTER_PASSES) || GetDebugFlag(DebugFlag::VISA_OUTPUT) ||
         GetDebugFlag(DebugFlag::VISA_BINARY) || GetDebugFlag(DebugFlag::VISA_DUMPCOMMONISA) ||
         IGC_IS_FLAG_ENABLED(EnableCapsDump) || IGC_IS_FLAG_ENABLED(ShaderOverride) ||
         IGC_IS_FLAG_ENABLED(GenerateOptionsFile);
}

OutputFolderName IGC_DEBUG_API_CALL GetBaseIGCOutputFolder() {
  static std::mutex m;
  std::lock_guard<std::mutex> lck(m);
  static std::string IGCBaseFolder;
  if (IGCBaseFolder != "") {
    return IGCBaseFolder.c_str();
  }
#if defined(_WIN64) || defined(_WIN32)
  if (!IGC_IS_FLAG_ENABLED(DumpToCurrentDir) && !IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    bool needMkdir = needMkDir();

    char dumpPath[256];

    sprintf_s(dumpPath, "c:\\Intel\\");
    if (GetFileAttributesA(dumpPath) != FILE_ATTRIBUTE_DIRECTORY && needMkdir) {
      _mkdir(dumpPath);
    }

    sprintf_s(dumpPath, "c:\\Intel\\IGC\\");
    if (GetFileAttributesA(dumpPath) != FILE_ATTRIBUTE_DIRECTORY && needMkdir) {
      _mkdir(dumpPath);
    }

    // Make sure we can write in the dump folder as the app may be sandboxed
    if (needMkdir) {
      int tmp_id = _getpid();
      std::string testFilename = std::string(dumpPath) + "testfile" + std::to_string(tmp_id);
      HANDLE testFile =
          CreateFileA(testFilename.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL);
      if (testFile == INVALID_HANDLE_VALUE) {
        char temppath[256];
        if (GetTempPathA(sizeof(temppath), temppath) != 0) {
          sprintf_s(dumpPath, "%sIGC\\", temppath);
        }
      } else {
        CloseHandle(testFile);
      }
    }

    if (GetFileAttributesA(dumpPath) != FILE_ATTRIBUTE_DIRECTORY && needMkdir) {
      _mkdir(dumpPath);
    }

    IGCBaseFolder = dumpPath;
  } else if (IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    std::string dumpPath = "c:\\Intel\\IGC\\"; // default if something goes wrong
    const char *custom_dir = IGC_GET_REGKEYSTRING(DumpToCustomDir);
    if (custom_dir != nullptr && strlen(custom_dir) > 0) {
      dumpPath = custom_dir;
    }

    char pathBuf[256];
    iSTD::CreateAppOutputDir(pathBuf, 256, dumpPath.c_str(), false, false, false);

    IGCBaseFolder = pathBuf;
  }
#elif defined ANDROID

  if (IGC_IS_FLAG_ENABLED(DumpToCurrentDir))
    return "";
  IGCBaseFolder = "/sdcard/intel/igc/";

#elif defined __linux__
  if (!IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    IGCBaseFolder = "/tmp/IntelIGC/";
  } else {
    std::string dumpPath = "/tmp/IntelIGC/"; // default if something goes wrong
    const char *custom_dir = IGC_GET_REGKEYSTRING(DumpToCustomDir);
    if (custom_dir != nullptr && strlen(custom_dir) > 0) {
      dumpPath = custom_dir;
      dumpPath += "/";
    }

    char pathBuf[256];
    iSTD::CreateAppOutputDir(pathBuf, 256, dumpPath.c_str(), false, false, false);

    IGCBaseFolder = pathBuf;
  }
#endif
  return IGCBaseFolder.c_str();
}

std::string &GetShaderOverridePathString() {
  static std::string path =
      IGC_IS_FLAG_ENABLED(ShaderOverride) ? std::string(GetBaseIGCOutputFolder()) + "ShaderOverride/" : "";
  return path;
}

void IGC_DEBUG_API_CALL SetShaderOverridePath(OutputFolderName pOutputFolderName) {
  static std::mutex m;
  std::lock_guard<std::mutex> lck(m);
  std::string &path = GetShaderOverridePathString();
  if (pOutputFolderName != nullptr) {
    path = pOutputFolderName;
  } else {
    path = "";
  }
}

OutputFolderName IGC_DEBUG_API_CALL GetShaderOverridePath() {
  // Return overridePath even though ShaderOverride is not set.
  std::string &overridePath = GetShaderOverridePathString();
  return overridePath.c_str();
}

OutputFolderName IGC_DEBUG_API_CALL GetShaderOutputFolder() {
  static std::mutex m;
  std::lock_guard<std::mutex> lck(m);
  if (g_shaderOutputFolder != "" && doesRegexMatch(g_shaderOutputFolder, IGC_GET_REGKEYSTRING(ShaderDumpRegexFilter))) {
    return g_shaderOutputFolder.c_str();
  }
#if defined(_WIN64) || defined(_WIN32)
  if (!IGC_IS_FLAG_ENABLED(DumpToCurrentDir) && !IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    char dumpPath[256];
    sprintf_s(dumpPath, "%s", GetBaseIGCOutputFolder());
    char appPath[MAX_PATH] = {0};
    // check a process id and make an adequate directory for it:

    if (::GetModuleFileNameA(NULL, appPath, sizeof(appPath) - 1)) {
      std::string appPathStr = std::string(appPath);
      int pos = appPathStr.find_last_of("\\") + 1;

      if (IGC_IS_FLAG_ENABLED(ShaderDumpPidDisable)) {
        sprintf_s(dumpPath, "%s%s\\", dumpPath, appPathStr.substr(pos, MAX_PATH).c_str());
      } else {
        sprintf_s(dumpPath, "%s%s_%d\\", dumpPath, appPathStr.substr(pos, MAX_PATH).c_str(), _getpid());
      }
    } else {
      sprintf_s(dumpPath, "%sunknownProcess_%d\\", dumpPath, _getpid());
    }

    if (needMkDir() && doesRegexMatch(dumpPath, IGC_GET_REGKEYSTRING(ShaderDumpRegexFilter))) {
      if (GetFileAttributesA(dumpPath) != FILE_ATTRIBUTE_DIRECTORY) {
        _mkdir(dumpPath);
      }
      g_shaderOutputFolder = dumpPath;
    } else {
      // To make the path always invalid.
      g_shaderOutputFolder = "NUL\\";
    }
  } else if (IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    char pathBuf[256];
    iSTD::CreateAppOutputDir(pathBuf, 256, GetBaseIGCOutputFolder(), false, true,
                             !IGC_IS_FLAG_ENABLED(ShaderDumpPidDisable));
    g_shaderOutputFolder = pathBuf;
  }
#elif defined ANDROID

  if (IGC_IS_FLAG_ENABLED(DumpToCurrentDir))
    return "";

  if (!SysUtils::CreateDir(GetBaseIGCOutputFolder(), true, IGC_IS_FLAG_DISABLED(ShaderDumpPidDisable),
                           &g_shaderOutputFolder))

    g_shaderOutputFolder = "";

#elif defined __linux__
  if (!IGC_IS_FLAG_ENABLED(DumpToCurrentDir) && g_shaderOutputFolder == "" && !IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    bool needMkdir =
        needMkDir() && doesRegexMatch(GetBaseIGCOutputFolder(), IGC_GET_REGKEYSTRING(ShaderDumpRegexFilter));

    char path[MAX_PATH] = {0};
    bool pidEnabled = IGC_IS_FLAG_DISABLED(ShaderDumpPidDisable);

    if (needMkdir) {
      iSTD::CreateAppOutputDir(path, MAX_PATH, GetBaseIGCOutputFolder(), false, true, pidEnabled);
      g_shaderOutputFolder = path;
    } else {
      // To make the path always invalid.
      g_shaderOutputFolder = "/dev/null/";
    }
  } else if (IGC_IS_FLAG_ENABLED(DumpToCustomDir)) {
    char pathBuf[256];
    iSTD::CreateAppOutputDir(pathBuf, 256, GetBaseIGCOutputFolder(), false, false, false);
    g_shaderOutputFolder = pathBuf;
  }

#endif
  return g_shaderOutputFolder.c_str();
}

OutputName IGC_DEBUG_API_CALL GetFunctionDebugFile() {
  if (IGC_GET_FLAG_VALUE(SelectiveFunctionControl) != 0) {
    static std::mutex m;
    std::lock_guard<std::mutex> lck(m);
    // If a custom file is specified by SelectiveFunctionControlFile
    // then use that for SelectiveFunctionControl. Otherwise,
    // fallback to FunctionDebug.txt in IGC output folder.
    static std::string functionDebugFilePath = IGC_GET_REGKEYSTRING(SelectiveFunctionControlFile);
    if (functionDebugFilePath == "") {
      functionDebugFilePath = std::string(GetBaseIGCOutputFolder()) + "FunctionDebug.txt";
    }
    return functionDebugFilePath.c_str();
  }
  return "";
}

OutputName IGC_DEBUG_API_CALL GetShaderOutputName() { return g_shaderOutputName.c_str(); }

VersionInfo IGC_DEBUG_API_CALL GetVersionInfo() { return g_cBuildInfo; }
#else // defined( IGC_DEBUG_VARIABLES )
      // C extern inline needs extern definition
extern "C" void IGC_DEBUG_API_CALL SetCompilerOptionValue(const char *flagName, int value);
extern "C" void IGC_DEBUG_API_CALL SetCompilerOptionString(const char *flagName, debugString s);

void IGC_DEBUG_API_CALL SetCompilerOptionOpaque(OptionFlag flag, void *data);


#endif // defined( IGC_DEBUG_VARIABLES )
} // namespace Debug
} // namespace IGC