@@ -169,6 +169,7 @@ struct KernelCompilerBinaryInfo {
169
169
Merge (const std::vector<const std::optional<KernelCompilerBinaryInfo> *>
170
170
&RTCInfos) {
171
171
std::optional<KernelCompilerBinaryInfo> Result = std::nullopt;
172
+ std::map<std::string, std::string> IncludePairMap;
172
173
for (const std::optional<KernelCompilerBinaryInfo> *RTCInfoPtr : RTCInfos) {
173
174
if (!RTCInfoPtr || !(*RTCInfoPtr))
174
175
continue ;
@@ -196,6 +197,20 @@ struct KernelCompilerBinaryInfo {
196
197
Result->MMangledKernelNames .insert (RTCInfo->MMangledKernelNames .begin (),
197
198
RTCInfo->MMangledKernelNames .end ());
198
199
200
+ // Assumption is that there are no duplicates, but in the case we let
201
+ // duplicates through it should be alright to pay for the minimal extra
202
+ // space allocated.
203
+ Result->MIncludePairs .reserve (RTCInfo->MIncludePairs .size ());
204
+ for (const auto &IncludePair : RTCInfo->MIncludePairs ) {
205
+ auto Inserted = IncludePairMap.insert (IncludePair);
206
+ if (!Inserted.second ) {
207
+ if (Inserted.first ->second != IncludePair.second )
208
+ throw sycl::exception (make_error_code (errc::invalid),
209
+ " Conflicting include files." );
210
+ } else {
211
+ Result->MIncludePairs .push_back (IncludePair);
212
+ }
213
+ }
199
214
Result->MIncludePairs .insert (Result->MIncludePairs .end (),
200
215
RTCInfo->MIncludePairs .begin (),
201
216
RTCInfo->MIncludePairs .end ());
0 commit comments