Virtual Function Management Extension¶
API¶
Functions
Enumerations
Structures
Virtual Function Management¶
This feature adds the ability to retrieve telemetry from PF domain for monitoring per VF memory and engine utilization. This telemetry is used to determine if a VM has oversubscribed GPU memory or observe engine business for a targeted workload. If VF has no activity value to report, then implementation shall reflect that appropriately in zes_vf_util_engine_exp2_t struct so that percentage calculation results in value of 0.
The following pseudo-code demonstrates a sequence for obtaining the engine activity for all Virtual Functions from Physical Function environment:
// Gather count of VF handles uint32_t numVf = 0; zes_vf_exp_capabilities_t vfProps {}; zesDeviceEnumEnabledVFExp(hDevice, &numVf, nullptr); // Allocate memory for vf handles and call back in to gather handles std::vector<zes_vf_handle_t> vfs(numVf, nullptr); zesDeviceEnumEnabledVFExp(hDevice, &numVf, vfs.data()); // Gather VF properties std::vector <zes_vf_exp_capabilities_t> vfCapabs(numVf); for (uint32_t i = 0; i < numVf; i++) { zesVFManagementGetVFCapabilitiesExp(vfs[i], &vfCapabs[i]); } // Detect the info types a particular VF supports // Using VF# 0 to demonstrate how to detect engine info type and query engine util info zes_vf_handle_t activeVf = vfs[0]; uint32_t engineStatCount = 0; zesVFManagementGetVFEngineUtilizationExp2(activeVf, &engineStatCount, nullptr); // Allocate memory for vf engine stats zes_vf_util_engine_exp2_t* engineStats0 = (zes_vf_util_engine_exp2_t*) allocate(engineStatCount * sizeof(zes_vf_util_engine_exp2_t)); zesVFManagementGetVFEngineUtilizationExp2(activeVf, &engineStatCount, engineStats0); sleep(1) zes_vf_util_engine_exp2_t* engineStats1 = (zes_vf_util_engine_exp2_t*) allocate(engineStatCount * sizeof(zes_vf_util_engine_exp2_t)); zesVFManagementGetVFEngineUtilizationExp2(activeVf, &engineStatCount, &engineStats1);