iree icon indicating copy to clipboard operation
iree copied to clipboard

[spirv] PyTorch AlexNet returns zeros on Apple M GPUs

Open PhaneeshB opened this issue 2 years ago • 3 comments

What happened?

On running Alexnet infernece on macos with SHARK, we see the output tensor is zero.

Steps to reproduce your issue

mlir: https://storage.googleapis.com/shark_tank/alexnet_torch/alexnet_torch.mlir input: https://storage.googleapis.com/shark_tank/alexnet_torch/inputs.npz golden_output: https://storage.googleapis.com/shark_tank/alexnet_torch/golden_out.npz

Compile and Run commands :

./iree-compile \
--iree-input-type=none \
--iree-vm-bytecode-module-output-format=flatbuffer-binary \
--iree-hal-target-backends=vulkan \
--iree-llvm-target-cpu-features=host \
-iree-vulkan-target-triple=m1-moltenvk-macos \
--iree-stream-resource-index-bits=64 \
--iree-vm-target-index-bits=64 \
/path_to/alexnet_torch_alexnet_torch.mlir -o alexnet_test.vmfb


-----

./iree-run-module \
--module_file=alexnet_test.vmfb \
--device=vulkan \
--entry_function=forward \
--function_input=@/_path_to_/alexnet_torch_inputs.npy

What component(s) does this issue relate to?

No response

Version information

No response

Additional context

Converted npz to npy (to use with iree-run-module) using the following steps:

import numpy as np
x = np.load("PATH TO input.npz")
np.save("PATH TO input.npy", x["arr_0"])
x.close()

PhaneeshB avatar Aug 11 '22 18:08 PhaneeshB

@antiagainst Can you take a look at this one to assign priority?

allieculp avatar Aug 15 '22 19:08 allieculp

It seems those files are moved? wget reports "Not Found". Could you provide the new locations for them?

antiagainst avatar Aug 18 '22 17:08 antiagainst

Here are the new locations: mlir: https://storage.googleapis.com/shark_tank/latest/alexnet_torch/alexnet_torch.mlir input: https://storage.googleapis.com/shark_tank/latest/alexnet_torch/inputs.npz golden_output: https://storage.googleapis.com/shark_tank/latest/alexnet_torch/golden_out.npz

PhaneeshB avatar Aug 25 '22 16:08 PhaneeshB

Closing this for now given this is Vulkan on MoltenVK -- we have native Metal support and that's the way forward.

antiagainst avatar Jun 24 '23 00:06 antiagainst