Skip to content

Commit 29a2e9f

Browse files
committed
Add a note about comparing types
Alexey Sachkov proposed an optimization for comparing the types in each IR instruction with the `!intel_types_that_use_aspects` set. Capture this in a note.
1 parent 722e4ca commit 29a2e9f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sycl/doc/OptionalDeviceFeatures.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,15 @@ type, the implementation implicitly assumes that the function uses
356356
`aspect::fp64` and adds that aspect to the function's `!intel_used_aspects`
357357
set.
358358

359+
**NOTE**: This scan of the IR will require comparing the type referenced by
360+
each IR instruction with the names of the types in the
361+
`!intel_types_that_use_aspects` metadata. It would be very inefficient if we
362+
did a string comparison each time. As an optimization, the implementation can
363+
first lookup up each type name in the `!intel_types_that_use_aspects` metadata
364+
set, finding the "type pointer" that corresponds to each type name. Then the
365+
pass over the IR can compare the type pointer in each IR instruction with the
366+
type pointers from the `!intel_types_that_use_aspects` metadata set.
367+
359368
The second bullet point requires building the static call graph, but the
360369
implementation need not scan the instructions in each function. Instead, it
361370
need only look at the `!intel_used_aspects` metadata for each function,

0 commit comments

Comments
 (0)