@@ -321,20 +321,15 @@ static void adjustArgs(const InputArgList &UserArgList,
321
321
DAL.AddJoinedArg (
322
322
nullptr , OptTable.getOption (OPT_resource_dir_EQ),
323
323
(DPCPPRoot + " /lib/clang/" + Twine (CLANG_VERSION_MAJOR)).str ());
324
- for (auto *Arg : UserArgList) {
325
- DAL.append (Arg);
326
- }
327
- // Remove args that will trigger an unused command line argument warning for
328
- // the FrontendAction invocation, but are handled later (e.g. during device
329
- // linking).
330
- DAL.eraseArg (OPT_fsycl_device_lib_EQ);
331
- DAL.eraseArg (OPT_fno_sycl_device_lib_EQ);
332
- DAL.eraseArg (OPT_ftime_trace_EQ);
333
- DAL.eraseArg (OPT_ftime_trace_granularity_EQ);
334
- DAL.eraseArg (OPT_ftime_trace_verbose);
324
+ // User args may contain options not intended for the frontend, but we can't
325
+ // claim them here to tell the driver they're used later. Hence, suppress the
326
+ // unused argument warning.
327
+ DAL.AddFlagArg (nullptr , OptTable.getOption (OPT_Qunused_arguments));
335
328
336
329
ArgStringList ASL;
337
330
for_each (DAL, [&DAL, &ASL](Arg *A) { A->render (DAL, ASL); });
331
+ for_each (UserArgList,
332
+ [&UserArgList, &ASL](Arg *A) { A->render (UserArgList, ASL); });
338
333
transform (ASL, std::back_inserter (CommandLine),
339
334
[](const char *AS) { return std::string{AS}; });
340
335
}
@@ -751,51 +746,22 @@ jit_compiler::parseUserArgs(View<const char *> UserArgs) {
751
746
UserArgsRef[MissingArgIndex], MissingArgIndex);
752
747
}
753
748
754
- // Check for unsupported options.
755
- // TODO: There are probably more, e.g. requesting non-SPIR-V targets.
756
- {
757
- // -fsanitize=address
758
- bool IsDeviceAsanEnabled = false ;
759
- if (Arg *A = AL.getLastArg (OPT_fsanitize_EQ, OPT_fno_sanitize_EQ)) {
760
- if (A->getOption ().matches (OPT_fsanitize_EQ) &&
761
- A->getValues ().size () == 1 ) {
762
- std::string SanitizeVal = A->getValue ();
763
- IsDeviceAsanEnabled = SanitizeVal == " address" ;
764
- }
765
- } else {
766
- // User can pass -fsanitize=address to device compiler via
767
- // -Xsycl-target-frontend.
768
- auto SyclFEArg = AL.getAllArgValues (OPT_Xsycl_frontend);
769
- IsDeviceAsanEnabled = (std::count (SyclFEArg.begin (), SyclFEArg.end (),
770
- " -fsanitize=address" ) > 0 );
771
- if (!IsDeviceAsanEnabled) {
772
- auto SyclFEArgEq = AL.getAllArgValues (OPT_Xsycl_frontend_EQ);
773
- IsDeviceAsanEnabled =
774
- (std::count (SyclFEArgEq.begin (), SyclFEArgEq.end (),
775
- " -fsanitize=address" ) > 0 );
776
- }
777
-
778
- // User can also enable asan for SYCL device via -Xarch_device option.
779
- if (!IsDeviceAsanEnabled) {
780
- auto DeviceArchVals = AL.getAllArgValues (OPT_Xarch_device);
781
- for (auto DArchVal : DeviceArchVals) {
782
- if (DArchVal.find (" -fsanitize=address" ) != std::string::npos) {
783
- IsDeviceAsanEnabled = true ;
784
- break ;
785
- }
786
- }
787
- }
788
- }
789
-
790
- if (IsDeviceAsanEnabled) {
791
- return createStringError (
792
- " Device ASAN is not supported for runtime compilation" );
793
- }
794
- }
795
-
796
- if (!AL.hasFlag (OPT_fsycl_device_code_split_esimd,
797
- OPT_fno_sycl_device_code_split_esimd, true )) {
798
- return createStringError (" ESIMD device code split cannot be deactivated" );
749
+ // Check for options that are unsupported because they would interfere with
750
+ // the in-memory pipeline.
751
+ Arg *UnsupportedArg =
752
+ AL.getLastArg (OPT_Action_Group, // Actions like -c or -S
753
+ OPT_Link_Group, // Linker flags
754
+ OPT_DebugInfo_Group, // Debugging
755
+ OPT_o, // Output file
756
+ OPT_fsycl_targets_EQ, // AoT compilation
757
+ OPT_fsycl_link_EQ, // SYCL linker
758
+ OPT_fno_sycl_device_code_split_esimd, // invoke_simd
759
+ OPT_fsanitize_EQ // Sanitizer
760
+ );
761
+ if (UnsupportedArg) {
762
+ return createStringError (
763
+ " Option '%s' is not supported for SYCL runtime compilation" ,
764
+ UnsupportedArg->getAsString (AL).c_str ());
799
765
}
800
766
801
767
return std::move (AL);
0 commit comments