Skip to content

Commit e185f88

Browse files
stefanatworkCopilot
andcommitted
Fix SYCL/ICX warnings in tutorial SYCL device code
Three classes of warning fixed, all from the ICX SYCL device compiler: 1. [-Wundefined-internal] sycl::detail::get_spec_constant_symbolic_ID has internal linkage but is not defined. 'const' variables at C++ namespace scope have *internal* linkage by default (same as 'static const'). The SYCL compiler generates a per-variable helper function with matching linkage; when that linkage is internal the function has no definition visible to the SYCL runtime and the warning fires. Fix: declare all sycl::specialization_id objects as 'inline const'. C++17 inline variables have external linkage, so the compiler emits one uniquely-identifiable definition. viewer_device_debug.cpp re-declares the same spec_feature_mask as inline const; the ODR rule merges it with viewer_device.cpp's definition at link time. Files changed: viewer_device.cpp, viewer_device_debug.cpp, next_hit_device.cpp, pathtracer_device.cpp 2. [-Wuninitialized-const-pointer] imgui_widgets.cpp: 'empty_string' passed as a const-pointer before being initialised. Fix: zero-initialise the STB_TEXTEDIT_CHARTYPE variable at the point of declaration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6ed84e4 commit e185f88

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

tutorials/common/imgui/imgui_widgets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4439,7 +4439,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
44394439
// Clear input
44404440
apply_new_text = "";
44414441
apply_new_text_length = 0;
4442-
STB_TEXTEDIT_CHARTYPE empty_string;
4442+
STB_TEXTEDIT_CHARTYPE empty_string = 0;
44434443
stb_textedit_replace(state, &state->Stb, &empty_string, 0);
44444444
}
44454445
else if (strcmp(buf, state->InitialTextA.Data) != 0)

tutorials/next_hit/next_hit_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RTCScene g_scene = nullptr;
1717
TutorialData data;
1818

1919
#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION) && defined(USE_SPECIALIZATION_CONSTANTS)
20-
static const sycl::specialization_id<RTCFeatureFlags> spec_feature_mask;
20+
inline const sycl::specialization_id<RTCFeatureFlags> spec_feature_mask;
2121
#endif
2222

2323
RTCFeatureFlags g_feature_mask;

tutorials/pathtracer/pathtracer_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ bool g_subdiv_mode = false;
3939
unsigned int keyframeID = 0;
4040

4141
#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION) && defined(USE_SPECIALIZATION_CONSTANTS)
42-
const static sycl::specialization_id<RTCFeatureFlags> rtc_feature_mask(RTC_FEATURE_FLAG_ALL);
42+
inline const sycl::specialization_id<RTCFeatureFlags> rtc_feature_mask(RTC_FEATURE_FLAG_ALL);
4343
#endif
4444
RTCFeatureFlags g_used_features = RTC_FEATURE_FLAG_NONE;
4545

tutorials/viewer/viewer_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extern "C" bool g_changed;
1010
TutorialData data;
1111

1212
#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION) && defined(USE_SPECIALIZATION_CONSTANTS)
13-
const sycl::specialization_id<RTCFeatureFlags> spec_feature_mask;
13+
inline const sycl::specialization_id<RTCFeatureFlags> spec_feature_mask;
1414
#endif
1515

1616
extern "C" RTCFeatureFlags g_feature_mask;

tutorials/viewer/viewer_device_debug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extern "C" bool g_changed;
1919
extern "C" float g_debug;
2020

2121
#if defined(EMBREE_SYCL_TUTORIAL) && !defined(EMBREE_SYCL_RT_SIMULATION)
22-
static const sycl::specialization_id<RTCFeatureFlags> spec_feature_mask;
22+
inline const sycl::specialization_id<RTCFeatureFlags> spec_feature_mask;
2323
#endif
2424

2525
extern "C" RTCFeatureFlags g_feature_mask;

0 commit comments

Comments
 (0)