intel / fpga-runtime-for-opencl

Intel® FPGA Runtime for OpenCL™ Software Technology
Other
34 stars 68 forks source link

Query whether the MMD supports buffer_location in shared/host USM allocations API calls #147

Closed zibaiwan closed 7 months ago

zibaiwan commented 2 years ago

In this https://github.com/intel/fpga-runtime-for-opencl/pull/141, we pass the buffer location information from the OpenCL runtime to the MMD USM allocation APIs. However, there are some MMDs which don't support buffer_location property, and this caused the allocation fails on those MMDs.

For 2022.3 release, the solution is to only pass buffer_location property to the MMD when targeting simulation. The query can be done through acl_get_offline_device_user_setting, 'CL_CONTEXT_MPSIM_DEVICE_INTELFPGA=1' or 'get_msim_mmd_layer()'.

For 2023.0, we could probably add something to the aocl_mmd_offline_info_t in aocl_mmd.h. Runtime could query whether the mmd supports buffer_location and only pass the buffer_location property if the mmd supports it. We need to test whether this approach breaks the existing MMDs that don't support buffer_locaiton, and also test it on the supporting MMD (probably starts with the simulation mmd). This requires co-ordination with the MMD owner.

ericxu233 commented 2 years ago

One small note: We currently don't cache the offline device user setting. So for this change, I have to query the environment variable again. We maybe want to add caching to these settings in the future?

pcolberg commented 2 years ago

We currently don't cache the offline device user setting. So for this change, I have to query the environment variable again. We maybe want to add caching to these settings in the future?

Thanks @ericxu233, that's a good point. In this case though we can hold off on caching this setting for now, since the plan for the next release, 2023.0 is to query buffer location support from the MMD via aocl_mmd_get_offline_info(), to support both simulator and selected hardware boards.

sophimao commented 9 months ago

Based on internal discussion the current plan is to use MMD version to determine whether buffer_location property is supported.