I tried to enable VM gpu tests for our pytorch frontend, and I found that VM GPU PR https://github.com/apache/incubator-tvm/pull/6337 broke one of the tests at https://github.com/apache/incubator-tvm/blob/master/tests/python/frontend/pytorch/lstm_test.py#L261
I realized that the test is not being run on CI because it is not picked by pytest (my mistake, the test should be renamed to test_custom_lstm.py
). I confirmed that the test passes if I go back to the commit before #6337.
When I run that test locally, I get an assertion error at https://github.com/apache/incubator-tvm/blob/master/python/tvm/relay/transform/memory_alloc.py#L102.
File "/home/masa/projects/dev/tvm/python/tvm/relay/transform/memory_alloc.py", line 102, in get_context
assert exp in self.context_analysis_map, exp.astext(False)
AssertionError: #[version = "0.0.5"]
free_var %t: Tensor[(2, 4), float32];
%0 = fn (%p0: Tensor[(2, 4), float32], Primitive=1) -> Tensor[(1, 2, 4), float32] {
expand_dims(%p0, axis=0) /* ty=Tensor[(1, 2, 4), float32] */
};
Looking at the result of context analysis, it seems tensor_expand_dims_float32_2_4
below is not annotated with device type and id. All other functions are correctly annotated and I get the assertion error only for the function wrapping expand_dims
above.
...
def @hd[A](%xs1: List[A]) -> A {
let %x45: A = match? (%xs1) {
Cons(%x46: A, _) => %x46,
}<cpu(0)>;
%x45<cpu(0)>
}
def @tensor_expand_dims_float32_2_4(%x47: static_tensor_float32_2_4_t[]) -> static_tensor_float32_?_2_4_t[] {
let %x48: static_tensor_float32_?_2_4_t[] = match? (%x47) {
tensor_constructor_float32_2_4(%t: Tensor[(2, 4), float32]) => {
%51 = fn (%p018: Tensor[(2, 4), float32], Primitive=1) -> Tensor[(1, 2, 4), float32] {
expand_dims(%p018, axis=0)
};
let %x49: Tensor[(1, 2, 4), float32] = %51(%t);
let %x50: static_tensor_float32_?_2_4_t[] = tensor_constructor_float32_?_2_4(%x49);
%x50
},
};
%x48
}
def @tl[A](%xs2: List[A]) -> List[A] {
let %x51: List[A] = match? (%xs2) {
Cons(_, %rest: List[A]) => %rest,
}<cpu(0)>;
%x51<cpu(0)>
}
...