INNER CODE UNIT · Rust

team_layout_and_fields_match_the_public_abi

NVIDIA/nccl · contrib/nccl4rust/crates/nccl-device-sys/src/lib.rs:132

    fn team_layout_and_fields_match_the_public_abi() {
        let team = ncclTeam_t {
            n_ranks: 8,
            rank: 3,
            stride: 2,
        };

        assert_eq!(size_of::<ncclTeam_t>(), 3 * size_of::<i32>());
        assert_eq!(align_of::<ncclTeam_t>(), align_of::<i32>());
        assert_eq!(offset_of!(ncclTeam_t, n_ranks), 0);
        assert_eq!(offset_of!(ncclTeam_t, rank), size_of::<i32>());
        assert_eq!(offset_of!(ncclTeam_t, stride), 2 * size_of::<i32>());
        assert_eq!((team.n_ranks, team.rank, team.stride), (8, 3, 2));
    }

    #[test]
    fn multimem_handle_is_one_pointer_wide() {
        let pointer = core::ptr::without_provenance_mut::<c_void>(0x1234);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…