Skip to content

Commit fd3e42f

Browse files
committed
Update DeviceGetconfComputeGpuAttestationReport to take struct as input
This is a BREAKING CHANGE, but one that is necessary, because the API is unusable in its current form. In the C API, the input struct us used to pass _both_ input _and_ output. In our original implementation we didn't take this struct as input, so there was no way to get this input passed into the function. The API has now been updated to correct this. One option could have been to just add the single input field as an input to the API call on its own, but this is not scalable in cases where one my add more input fields to the struct in the future. In the end, (even though this goes against our other wrapper API calls), we decided it was best to just pass the whole struct and assume its usage as both input and output just like the C API. We plan to revisit how to more comprehensively accommodate APIS such as this in the future. Signed-off-by: Kevin Klues <[email protected]>
1 parent 3a9ba18 commit fd3e42f

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

pkg/nvml/device.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,14 +2971,12 @@ func (device nvmlDevice) GetConfComputeGpuCertificate() (ConfComputeGpuCertifica
29712971
}
29722972

29732973
// nvml.DeviceGetConfComputeGpuAttestationReport()
2974-
func (l *library) DeviceGetConfComputeGpuAttestationReport(device Device) (ConfComputeGpuAttestationReport, Return) {
2975-
return device.GetConfComputeGpuAttestationReport()
2974+
func (l *library) DeviceGetConfComputeGpuAttestationReport(device Device, gpuAtstReport *ConfComputeGpuAttestationReport) Return {
2975+
return device.GetConfComputeGpuAttestationReport(gpuAtstReport)
29762976
}
29772977

2978-
func (device nvmlDevice) GetConfComputeGpuAttestationReport() (ConfComputeGpuAttestationReport, Return) {
2979-
var gpuAtstReport ConfComputeGpuAttestationReport
2980-
ret := nvmlDeviceGetConfComputeGpuAttestationReport(device, &gpuAtstReport)
2981-
return gpuAtstReport, ret
2978+
func (device nvmlDevice) GetConfComputeGpuAttestationReport(gpuAtstReport *ConfComputeGpuAttestationReport) Return {
2979+
return nvmlDeviceGetConfComputeGpuAttestationReport(device, gpuAtstReport)
29822980
}
29832981

29842982
// nvml.DeviceSetConfComputeUnprotectedMemSize()

pkg/nvml/mock/device.go

Lines changed: 12 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/nvml/mock/interface.go

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/nvml/zz_generated.api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ type Interface interface {
437437
DeviceGetComputeInstanceId(Device) (int, Return)
438438
DeviceGetComputeMode(Device) (ComputeMode, Return)
439439
DeviceGetComputeRunningProcesses(Device) ([]ProcessInfo, Return)
440-
DeviceGetConfComputeGpuAttestationReport(Device) (ConfComputeGpuAttestationReport, Return)
440+
DeviceGetConfComputeGpuAttestationReport(Device, *ConfComputeGpuAttestationReport) Return
441441
DeviceGetConfComputeGpuCertificate(Device) (ConfComputeGpuCertificate, Return)
442442
DeviceGetConfComputeMemSizeInfo(Device) (ConfComputeMemSizeInfo, Return)
443443
DeviceGetConfComputeProtectedMemoryUsage(Device) (Memory, Return)
@@ -814,7 +814,7 @@ type Device interface {
814814
GetComputeInstanceId() (int, Return)
815815
GetComputeMode() (ComputeMode, Return)
816816
GetComputeRunningProcesses() ([]ProcessInfo, Return)
817-
GetConfComputeGpuAttestationReport() (ConfComputeGpuAttestationReport, Return)
817+
GetConfComputeGpuAttestationReport(*ConfComputeGpuAttestationReport) Return
818818
GetConfComputeGpuCertificate() (ConfComputeGpuCertificate, Return)
819819
GetConfComputeMemSizeInfo() (ConfComputeMemSizeInfo, Return)
820820
GetConfComputeProtectedMemoryUsage() (Memory, Return)

0 commit comments

Comments
 (0)