Recently I come across several problems when trying sgx in tvm/apps. To begin with, in tvm/apps/sgx/Cargo.toml, the dependencies are still:
[dependencies]
tvm-runtime = { path = "../../rust/runtime" }
But tvm/rust/runtime was removed, and I only found that tvm-graph-rt matches the code in tvm/apps/sgx best, so I replaced all the tvm-runtime with tvm-graph-rt in tvm/apps/sgx. After that I ran ‘cargo run’ command and found that:
Compiling sgx-demo v0.1.0 (/home/ice/SGX/Tvm/tvm/apps/sgx)
Finished dev [unoptimized + debuginfo] target(s) in 13.34s
Running `ftxsgx-runner-cargo target/x86_64-fortanix-unknown-sgx/debug/sgx-demo`
Attaching debugger
Error while executing SGX enclave.
Enclave panicked: memory allocation of 9437184 bytes failed
It meant that heap size of SGX enclave was not enough, so I changed heap size from 0x2000000 to 0x4000000 in ftxsgx-runner-cargo.rs and built the runner again. Finally there wasn’t any obvious bug. But after I ran ‘head -c $((28*28*4)) /dev/urandom | nc 127.0.0.1 4242 | python read_results.py’ command. The runner for apps/sgx hung up and did nothing.
Now I have figured out that the runner have received the 28*28 image, but it doesn’t receive the computation result from enclave, I guess that it may stop in enclave, but I am a newbie to tvm and rust and now I have no idea, maybe code in tvm/apps/sgx needs to be updated as tvm/rust/runtime have been removed for a long time.
Environment
- Ubuntu 20.04
- TVM: 0.8.dev0
- I installed TVM following the tutorials in Install from Source — tvm 0.8.dev0 documentation