Closed StephanvanSchaik closed 2 years ago
Checking out the main branch as follows and running the same test as in the Github workflow as follows also results in this error:
git clone https://github.com/JohnTitor/mach2
cd mach2
TARGET=aarch64-apple-darwin RUST_VERSION=nightly ci/run.sh
That is, the main branch without this PR currently seems to fail on the same issue as well. This might be a problem with Rust nightly.
That is, the main branch without this PR currently seems to fail on the same issue as well. This might be a problem with Rust nightly.
Nah, https://github.com/JohnTitor/mach2/runs/5379204089?check_suite_focus=true shows a lot of errors about thread_standard_policy
. Note that mach-test only runs on nightly.
That is, the main branch without this PR currently seems to fail on the same issue as well. This might be a problem with Rust nightly.
Nah, https://github.com/JohnTitor/mach2/runs/5379204089?check_suite_focus=true shows a lot of errors about
thread_standard_policy
. Note that mach-test only runs on nightly.
Apparently, TARGET=aarch64-apple-darwin
is not supposed to work, but running the following works fine on the Apple M1:
git clone https://github.com/JohnTitor/mach2
cd mach2
TARGET=x86_64-apple-darwin RUST_VERSION=nightly ci/run.sh
It looks like mach-test tries to compare the Rust code against the C header, which is nice, it just wasn't clear to me initially. I fixed the struct names in mach-test/build.rs
, added use mach2::thread_policy::*;
to mach-test/src/main.rs
and then fixed the issues in src/thread_policy.rs
. Then I ran: TARGET=x86_64-apple-darwin RUST_VERSION=nightly ci/run.sh
to ensure that the tests pass.
Thanks for the pointer.
This PR implements part of the thread policy API used to retrieve and request the policy for any given thread. More specifically, while this can be used to indicate to Mac OS that the thread is computationally intensive or rather a background thread, this API can also be used to set up latency-based or throughput-based QoS. Furthermore, Mac OS provides an affinity policy that allows one to indirectly set the affinity of threads to indicate whether certain CPU resources such as the L2 cache should or should not be shared between threads. Therefore, the affinity policy can be used as a hint to the scheduler for thread placement.