-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change types for some tests to correct types #315
base: main
Are you sure you want to change the base?
Conversation
--input=3x4xui16=@input_0.bin | ||
--input=3x4xbf16=@input_0.bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files are generated. The type conversion from onnx happens here:
SHARK-TestSuite/iree_tests/onnx/import_tests_utils.py
Lines 10 to 24 in 52468d6
# map numpy dtype -> (iree dtype, struct.pack format str) | |
dtype_map = { | |
np.dtype("int64"): ("si64", "q"), | |
np.dtype("uint64"): ("ui64", "Q"), | |
np.dtype("int32"): ("si32", "i"), | |
np.dtype("uint32"): ("ui32", "I"), | |
np.dtype("int16"): ("si16", "h"), | |
np.dtype("uint16"): ("ui16", "H"), | |
np.dtype("int8"): ("si8", "b"), | |
np.dtype("uint8"): ("ui8", "B"), | |
np.dtype("float64"): ("f64", "d"), | |
np.dtype("float32"): ("f32", "f"), | |
np.dtype("float16"): ("f16", "e"), | |
np.dtype("bool"): ("i1", "?"), | |
} |
SHARK-TestSuite/iree_tests/onnx/import_tests.py
Lines 142 to 147 in 52468d6
t = convert_io_proto(test_input, model.graph.input[i].type) | |
if t is None: | |
return False | |
input_path = (imported_dir_path / test_input.stem).with_suffix(".npy") | |
np.save(input_path, t) # Only for ref, actual comparison with .bin | |
ss = get_shape_string(t) |
is that code not handling a case here? I'd expect the WARNING: unsupported data type in get_shape_string
to be hit 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we can run the generator once and then manually update tests like this, I don't want for future runs of the generator to need to manually make these same changes, so I'd prefer for the generator to be taught to make these changes itself.
If we're losing information across the onnx -> numpy -> iree translation, we could add some special cases in the generator script (similar to how I suggested adding per-test tolerances on #311 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would need to dig into the proto but my guess is that they just identify themselves at uint16 with an internal bitcast. bf16
is a bit weird because from a data standpoint its just a truncated f32
and is basically treated that way. This results in buffers often just being passed around at uint16
Oh, can you sync past 53bedfb ? The important detail there is the |
No description provided.