MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / get_mali_hw_info

Function get_mali_hw_info

tests/framework/instruments/MaliCounter.cpp:45–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43};
44
45MaliHWInfo get_mali_hw_info(const char *path)
46{
47 int fd = open(path, O_RDWR); // NOLINT
48
49 if (fd < 0)
50 {
51 ARM_COMPUTE_ERROR("Failed to get HW info.");
52 }
53
54 {
55 mali_userspace::uku_version_check_args version_check_args; // NOLINT
56 version_check_args.header.id = mali_userspace::UKP_FUNC_ID_CHECK_VERSION; // NOLINT
57 version_check_args.major = 10;
58 version_check_args.minor = 2;
59
60 if (mali_userspace::mali_ioctl(fd, version_check_args) != 0)
61 {
62 ARM_COMPUTE_ERROR("Failed to check version.");
63 close(fd);
64 }
65 }
66
67 {
68 mali_userspace::kbase_uk_hwcnt_reader_set_flags flags; // NOLINT
69 memset(&flags, 0, sizeof(flags));
70 flags.header.id = mali_userspace::KBASE_FUNC_SET_FLAGS; // NOLINT
71 flags.create_flags = mali_userspace::BASE_CONTEXT_CREATE_KERNEL_FLAGS;
72
73 if (mali_userspace::mali_ioctl(fd, flags) != 0)
74 {
75 ARM_COMPUTE_ERROR("Failed settings flags ioctl.");
76 close(fd);
77 }
78 }
79
80 {
81 mali_userspace::kbase_uk_gpuprops props; // NOLINT
82 props.header.id = mali_userspace::KBASE_FUNC_GPU_PROPS_REG_DUMP; // NOLINT
83
84 if (mali_ioctl(fd, props) != 0)
85 {
86 ARM_COMPUTE_ERROR("Failed settings flags ioctl.");
87 close(fd);
88 }
89
90 MaliHWInfo hw_info; // NOLINT
91 memset(&hw_info, 0, sizeof(hw_info));
92 hw_info.gpu_id = props.props.core_props.product_id;
93 hw_info.r_value = props.props.core_props.major_revision;
94 hw_info.p_value = props.props.core_props.minor_revision;
95
96 for (unsigned int i = 0; i < props.props.coherency_info.num_core_groups; ++i)
97 {
98 hw_info.core_mask |= props.props.coherency_info.group[i].core_mask;
99 }
100
101 hw_info.mp_count = __builtin_popcountll(hw_info.core_mask);
102

Callers 1

initMethod · 0.85

Calls 1

mali_ioctlFunction · 0.85

Tested by

no test coverage detected