@@ -48,7 +48,6 @@ static void
4848l_init_kernel_invocation_wrapper (acl_kernel_invocation_wrapper_t *wrapper,
4949 unsigned i);
5050static void l_forcibly_release_allocations (cl_context context);
51- static cl_device_id l_find_device_by_name (const std::string &name);
5251static cl_int l_update_program_library_root (cl_context context,
5352 const char *new_root);
5453static cl_int l_update_compile_command (cl_context context, const char *new_cmd);
@@ -553,7 +552,6 @@ static cl_int l_finalize_context(cl_context context, cl_uint num_devices,
553552static cl_int l_load_properties (cl_context context,
554553 const cl_context_properties *properties) {
555554 const char *default_compile_cmd = 0 ;
556- int env_override = 0 ;
557555 acl_assert_locked ();
558556
559557 // Set defaults.
@@ -607,12 +605,11 @@ static cl_int l_load_properties(cl_context context,
607605 }
608606 }
609607
610- // Environment variable can specify we always an offline device.
611- if (!acl_platform.offline_device .empty ()) {
612- if (!l_find_device_by_name (acl_platform.offline_device ))
613- ERR_RET (CL_INVALID_VALUE, context,
614- " Invalid offline device specified by environment variable "
615- " CL_CONTEXT_OFFLINE_DEVICE_INTELFPGA" );
608+ // Check if environment variable specified offline device is valid
609+ if (acl_platform.has_offline_device < 0 ) {
610+ ERR_RET (CL_INVALID_VALUE, context,
611+ " Invalid offline device specified by environment variable "
612+ " CL_CONTEXT_OFFLINE_DEVICE_INTELFPGA" );
616613 }
617614
618615 // Get default for program_library_root.
@@ -717,8 +714,6 @@ static cl_int l_load_properties(cl_context context,
717714 // Always terminate list. After all, 'properties' might be empty!
718715 context->properties [context->num_property_entries ++] = 0 ;
719716
720- (void )acl_get_offline_device_user_setting (&env_override);
721-
722717 context->compiles_programs_incompletely = 0 ;
723718 switch (context->compiler_mode ) {
724719 case static_cast <acl_compiler_mode_t >(
@@ -788,7 +783,7 @@ static cl_int l_load_properties(cl_context context,
788783 // We need backing store for the buffers.
789784 context->device_buffers_have_backing_store = 1 ;
790785
791- if (env_override == ACL_CONTEXT_MPSIM) {
786+ if (acl_platform. offline_mode == ACL_CONTEXT_MPSIM) {
792787 // Simulator should support save/restore buffers around programming if
793788 // reprogramming on-the-fly is supported
794789 context->saves_and_restores_buffers_for_reprogramming = 1 ;
@@ -820,17 +815,6 @@ static cl_int l_load_properties(cl_context context,
820815 return CL_SUCCESS;
821816}
822817
823- static cl_device_id l_find_device_by_name (const std::string &name) {
824- acl_assert_locked ();
825-
826- for (unsigned i = 0 ; i < acl_platform.num_devices ; ++i) {
827- if (name == acl_platform.device [i].def .autodiscovery_def .name ) {
828- return &(acl_platform.device [i]);
829- }
830- }
831- return 0 ;
832- }
833-
834818// Initialize the given context.
835819// Yes, this is like a "placement new".
836820//
@@ -886,8 +870,6 @@ static cl_int l_init_context_with_devices(cl_context context,
886870 int num_present = 0 ;
887871 int num_absent = 0 ;
888872 for (cl_uint i = 0 ; i < num_devices; i++) {
889- int usable = devices[i]->present ;
890-
891873 // Can't mix both (actually) present and absent devices because there
892874 // is no consistent way to place device global memory.
893875 if (devices[i]->present ) {
@@ -903,10 +885,7 @@ static cl_int l_init_context_with_devices(cl_context context,
903885 " Can't create a context with both offline and online devices" );
904886 }
905887
906- usable = usable || acl_platform.offline_device ==
907- devices[i]->def .autodiscovery_def .name ;
908-
909- if (!usable)
888+ if (!devices[i]->present && !devices[i]->offline )
910889 ERR_RET (CL_DEVICE_NOT_AVAILABLE, context, " Device not available" );
911890
912891 // Mark the device(s) as opened
0 commit comments