@@ -48,7 +48,6 @@ static void
48
48
l_init_kernel_invocation_wrapper (acl_kernel_invocation_wrapper_t *wrapper,
49
49
unsigned i);
50
50
static void l_forcibly_release_allocations (cl_context context);
51
- static cl_device_id l_find_device_by_name (const std::string &name);
52
51
static cl_int l_update_program_library_root (cl_context context,
53
52
const char *new_root);
54
53
static 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,
553
552
static cl_int l_load_properties (cl_context context,
554
553
const cl_context_properties *properties) {
555
554
const char *default_compile_cmd = 0 ;
556
- int env_override = 0 ;
557
555
acl_assert_locked ();
558
556
559
557
// Set defaults.
@@ -607,9 +605,8 @@ static cl_int l_load_properties(cl_context context,
607
605
}
608
606
}
609
607
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 ))
608
+ // Check if environment variable specified offline device is valid
609
+ if (acl_platform.has_offline_device < 0 ) {
613
610
ERR_RET (CL_INVALID_VALUE, context,
614
611
" Invalid offline device specified by environment variable "
615
612
" CL_CONTEXT_OFFLINE_DEVICE_INTELFPGA" );
@@ -717,8 +714,6 @@ static cl_int l_load_properties(cl_context context,
717
714
// Always terminate list. After all, 'properties' might be empty!
718
715
context->properties [context->num_property_entries ++] = 0 ;
719
716
720
- (void )acl_get_offline_device_user_setting (&env_override);
721
-
722
717
context->compiles_programs_incompletely = 0 ;
723
718
switch (context->compiler_mode ) {
724
719
case static_cast <acl_compiler_mode_t >(
@@ -788,7 +783,7 @@ static cl_int l_load_properties(cl_context context,
788
783
// We need backing store for the buffers.
789
784
context->device_buffers_have_backing_store = 1 ;
790
785
791
- if (env_override == ACL_CONTEXT_MPSIM) {
786
+ if (acl_platform. offline_mode == ACL_CONTEXT_MPSIM) {
792
787
// Simulator should support save/restore buffers around programming if
793
788
// reprogramming on-the-fly is supported
794
789
context->saves_and_restores_buffers_for_reprogramming = 1 ;
@@ -820,17 +815,6 @@ static cl_int l_load_properties(cl_context context,
820
815
return CL_SUCCESS;
821
816
}
822
817
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
-
834
818
// Initialize the given context.
835
819
// Yes, this is like a "placement new".
836
820
//
@@ -886,8 +870,6 @@ static cl_int l_init_context_with_devices(cl_context context,
886
870
int num_present = 0 ;
887
871
int num_absent = 0 ;
888
872
for (cl_uint i = 0 ; i < num_devices; i++) {
889
- int usable = devices[i]->present ;
890
-
891
873
// Can't mix both (actually) present and absent devices because there
892
874
// is no consistent way to place device global memory.
893
875
if (devices[i]->present ) {
@@ -903,10 +885,7 @@ static cl_int l_init_context_with_devices(cl_context context,
903
885
" Can't create a context with both offline and online devices" );
904
886
}
905
887
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 )
910
889
ERR_RET (CL_DEVICE_NOT_AVAILABLE, context, " Device not available" );
911
890
912
891
// Mark the device(s) as opened
0 commit comments