tvm icon indicating copy to clipboard operation
tvm copied to clipboard

[Bugfix][Runtime] Fix sched_setaffinity in Android

Open sunjiweiswift opened this issue 2 years ago • 5 comments

sched_setaffinity should use pid_t instread of pthread_t https://man7.org/linux/man-pages/man2/sched_setaffinity.2.html

cc @areusch

sunjiweiswift avatar Jun 07 '22 09:06 sunjiweiswift

@areusch

sunjiweiswift avatar Jun 08 '22 02:06 sunjiweiswift

i think @huajsj might have context around this. @sunjiweiswift could you update the PR title and body as well similar to the other PR?

areusch avatar Jun 09 '22 19:06 areusch

It feels a little weird doing something different on regular Linux vs. Android. Can we get rid of the pthread_setaffinity_np call and just use sched_setaffinity on Linux? I think we could get rid of the duplicate thread argument that way. The only reason to keep it is if we supported SetThreadAffinity on platforms other than Linux (and had to use std::thread::native_handle_type) but we don't.

supersat avatar Jun 16 '22 23:06 supersat

@supersat Can we get rid of the pthread_setaffinity_np call and just use sched_setaffinity on Linux? I think we can just use seched_setaffinity on Linux and Android

sunjiweiswift avatar Jun 17 '22 02:06 sunjiweiswift

looks like some of the hexagon tests are segfaulting now, e.g.:

tests/python/contrib/test_hexagon/topi/test_avg_pool2d_slice.py::TestAvgPool2dSlice::test_avg_pool2d_slice[nhwc-8h2w32c2w-2d-stride6-kernel6-float16-dilation6-padding6-True-nhwc-8h2w32c2w-2d-output_shape6-False]

anyone able to look?

areusch avatar Jun 21 '22 19:06 areusch