Skip to content

Commit 2b550b0

Browse files
committed
removed redundant codes caught by the linter
1 parent 09ff8a3 commit 2b550b0

2 files changed

Lines changed: 10 additions & 19 deletions

File tree

backends/ze/ze_validator_entry_exit_helpers.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'ze_validator_zemodel'
22
require 'ze_library'
33

4-
def check_group_property_queued(state, ctx, defi, device)
4+
def check_group_property_queued(state, ctx, device)
55
#puts "device = #{device}"
66
unless device.cmd_queue_group_properties_queried
77
state.print_usage_error(ctx,"command queue group wasn't queried. Hardcoded group properties may break the code on different devices")
@@ -89,7 +89,7 @@ def get_memory_overlap(mem1, mem2)
8989
elsif mem2.base <= mem1.base && mem1.base <= mem2.base + mem2.size
9090
overlap << mem1.base
9191
overlap << [mem2.base+mem2.size, mem1.base+mem1.size].min
92-
end
92+
end
9393
end
9494
overlap
9595
end
@@ -103,7 +103,7 @@ def record_copy_over(state,ctx,ptr1,ptr2)
103103
end
104104
end
105105

106-
def check_copy_over_data_race(state,ctx,defi,src_ptr,dst_ptr)
106+
def check_copy_over_data_race(state,ctx,src_ptr,dst_ptr)
107107
memory_allocations = state.find_objects(ctx, 'memory_allocation')
108108
src = memory_allocations[src_ptr]
109109
dst = memory_allocations[dst_ptr]
@@ -160,7 +160,7 @@ def check_oob_memory_copy(state,ctx,defi)
160160
end
161161
end
162162

163-
def check_struct_stype_misuse(state,ctx,defi,expected_stype, observed_stype)
163+
def check_struct_stype_misuse(state,ctx,expected_stype, observed_stype)
164164
if state.device_agnostic && expected_stype != observed_stype
165165
state.print_usage_error(ctx,"\nExpected stype of #{expected_stype}\nbut #{observed_stype} was observed.")
166166
end

backends/ze/ze_validator_function_entry_exit_callbacks.rb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,9 @@
3737
src_ptr = defi['srcptr']
3838
record_copy_over(state,ctx,src_ptr,dst_ptr)
3939
check_memory_residency(state,ctx,defi,src_ptr,dst_ptr,"zeCommandListAppendMemoryCopyRegion")
40-
check_copy_over_data_race(state,ctx,defi,src_ptr,dst_ptr)
40+
check_copy_over_data_race(state,ctx,src_ptr,dst_ptr)
4141
}
4242

43-
#remove the elements from state.memory_in_transit
44-
$on_successful_exit["zeCommandListAppendMemoryCopyRegion"] = lambda{|state, ctx, defi|
45-
memory_allocations = state.find_objects(ctx, 'memory_allocation')
46-
context = state.find_object(ctx, 'context', 'hContext')
47-
device = state.find_object(ctx, 'device','hDevice')
48-
size = state.find_param(ctx,"size")
49-
handle = defi['pptr_val']
50-
51-
}
5243

5344
$upon_entry["zeDeviceGetProperties"] = lambda{|state, ctx, defi|
5445
device_ptr = defi['hDevice']
@@ -82,7 +73,7 @@
8273
$upon_entry["zeCommandListAppendLaunchCooperativeKernel"] = lambda { |state, ctx, defi|
8374
command_lists = state.find_objects(ctx, 'command_list')
8475
cmd_list = command_lists[defi['hCommandList']]
85-
check_group_property_queued(stte,ctx,defi,cmd_list.device)
76+
check_group_property_queued(stte,ctx,cmd_list.device)
8677
}
8778

8879
#when command queue is executed, the associated fence's status is set to IN_USE
@@ -95,12 +86,11 @@
9586
#check if the group property was hardcoded
9687
command_queues = state.find_objects(ctx, 'command_queue')
9788
command_queue = command_queues[defi['hCommandQueue']]
98-
check_group_property_queued(state,ctx,defi,command_queue.device)
89+
check_group_property_queued(state,ctx,command_queue.device)
9990
}
10091

10192
#When a fence signals the host, set the fence's status to signaled
10293
$upon_entry["zeFenceHostSynchronize"] = lambda { |state, ctx, defi|
103-
fences = nil
10494
curr_fence = ZEModel::Fence.get_fence(state,ctx,defi)
10595
return unless curr_fence
10696
if curr_fence.status == ZEModel::Fence.class_variable_get(:@@SIGNALED)
@@ -317,7 +307,7 @@
317307
altdesc_val = state.find_param(ctx, 'altdesc_val')
318308
altdesc = state.to_struct(altdesc_val, ZE::ZECommandQueueDesc)
319309
handle = defi['phCommandList_val']
320-
check_group_property_queued(state,ctx,defi,device)
310+
check_group_property_queued(state,ctx,device)
321311
command_lists[handle] = ZEModel::CommandList.new(handle, context, device, nil, altdesc)
322312
command_lists[handle].immediate = true #immdediate command lists cannot be passed to the execute command lists
323313
command_list[handle].associated_ordinal = altdesc.ordinal
@@ -440,7 +430,7 @@
440430

441431
if state.print_tracker["zeMemAllocDevice::StypeMisuse"] == 0
442432
state.print_tracker["zeMemAllocDevice::StypeMisuse"] = 1
443-
check_struct_stype_misuse(state,ctx,defi,:ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC, device_desc[:stype].to_sym)
433+
check_struct_stype_misuse(state,ctx,:ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC, device_desc[:stype].to_sym)
444434
end
445435
}
446436

@@ -456,6 +446,7 @@
456446
memory_allocations[handle] = memory_allocation
457447
device.memory_allocations[handle] = memory_allocation
458448
}
449+
459450
#remove the transit info when the copy region returns
460451
$on_successful_exit["zeCommandListAppendMemoryCopyRegion"] = lambda { |state, ctx, defi|
461452
src_ptr = state.find_param(ctx,"srcptr")

0 commit comments

Comments
 (0)