-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][FPGA] Support Intel FPGA simulator device selector #6715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Create fpga_simulator_selector to be used to select the FPGA simulator. This assumes that the user has compiled their program with -Xssimulation (as well as -fintelfpga) to prepare for the simulator. An object of class fpga_simulator_selector must be constructed early in the execution of the host program in order to make the simulator available at runtime. The emulator and hardware FPGA device selectors will prefer the emulator/hardware over a simulation device if both have the same device name.
The failing tests have nothing to do with my change. What can/should I do? |
I tried with SetEnvironmentA, and it didn't work for me
Create fpga_simulator_selector to be used to select the FPGA simulator. This assumes that the user has compiled their program with -Xssimulation (as well as -fintelfpga) to prepare for the simulator. An object of class fpga_simulator_selector must be constructed early in the execution of the host program in order to make the simulator available at runtime. The emulator and hardware FPGA device selectors will prefer the emulator/hardware over a simulation device if both have the same device name.
I tried with SetEnvironmentA, and it didn't work for me
At this point, I am okay with the restriction that the simulator device replaces any hardware ones. It is unlikely that anyone interested in using the simulator would also want to use hardware in the same program
At this point, I am okay with the restriction that the simulator device replaces any hardware ones. It is unlikely that anyone interested in using the simulator would also want to use hardware in the same program
I changed my mind. This is now okay to review. We will live with the hardware/simulator restriction as if is unlikely for a user to want both simultaneously. I have updated to re-use existing code |
How do I fix a clang-format failure in a clang file that I didn't change? clang/lib/Sema/SemaChecking.cpp |
// Currently only 1 simulator device is supported | ||
auto devices = std::to_string(numDevices); | ||
#ifdef _WIN32 | ||
_putenv_s("CL_CONTEXT_MPSIM_DEVICE_INTELFPGA", devices.c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please provide a link to some documentation for this env var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is documented in oneAPI and for OpenCL in 11.1.7.2. Simulating Your OpenCL Library in OpenCL
For oneAPI, the intent is to hide this environment variable from the user, as it is very intrusive. OpenCL has a multi-step process for running programs, while oneAPI hides all that. We would prefer it not to be openly documented.
When compiling for OpenCL for simulation, the aoc command explicitly tells the user to set the variable. For oneAPI, aoc does not print this message
Is it possible to resolve this today? We want to get the code sample changes in by CC (Thursday?), so there is a bit of a rush |
Document fpga_simulator_selector in official documentation. Bump the version to 2.
Do you mind using this PR to update the extension specification to use the official template? I know the existing spec does not follow that template, but this seems like a good opportunity to remove some technical debt. The specification needs to be updated anyway to make it clear that the new
Some of this information seems like important stuff that the user needs to know. If so, it should be added to the extension specification, perhaps as a NOTE. For example:
Note that the SYCL 2020 style for selectors is to define an object that is the selector, not to define a type that the application has to construct. Do you plan to update this extension to follow that style? Mentioning this now in case you want to migrate to the new style now and then add this new selector only with the new style. |
Rewrite as requested. Document current restrictions with the simulator selector affecting hardware.
Updated to the current template. I am not going to change to the object format at this time, as the current implementation of the FPGA runtime needs to be enhanced to support having the simulator active at all times first |
sycl/doc/extensions/supported/sycl_ext_intel_fpga_device_selector.asciidoc
Show resolved
Hide resolved
sycl/doc/extensions/supported/sycl_ext_intel_fpga_device_selector.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/supported/sycl_ext_intel_fpga_device_selector.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/supported/sycl_ext_intel_fpga_device_selector.asciidoc
Outdated
Show resolved
Hide resolved
Build check failures are not related to my changes |
Create fpga_simulator_selector to be used to select the FPGA simulator device. This assumes that the user has compiled their program with -Xssimulation (as well as -fintelfpga) to prepare for the simulator.
An object of class fpga_simulator_selector must be constructed early in the execution of the host program in order to make the simulator available at runtime.
The current implementation has the effect that if an object of class sycl::ext::intel::fpga_simulator_selector is defined, FPGA hardware devices selected using sycl::ext::intel::fpga_selector will select simulator devices. This will be documented in the release notes and the specification. We expect this behaviour to be eliminated in the future.