MCPcopy Index your code
hub / github.com/apache/tvm / getDeviceAPI

Method getDeviceAPI

web/src/webgpu.ts:863–903  ·  view source on GitHub ↗

* Get the device API according to its name * @param name The name of the API. * @returns The corresponding device api.

(name: string)

Source from the content-addressed store, hash-verified

861 * @returns The corresponding device api.
862 */
863 getDeviceAPI(name: string): Function {
864 if (name == "deviceAllocDataSpace") {
865 return (nbytes: number): GPUPointer => {
866 return this.deviceAllocDataSpace(nbytes);
867 };
868 } else if (name == "deviceFreeDataSpace") {
869 return (ptr: GPUPointer): void => {
870 return this.deviceFreeDataSpace(ptr);
871 };
872 } else if (name == "deviceCopyToGPU") {
873 return (
874 from: Pointer,
875 to: GPUPointer,
876 toOffset: number,
877 nbytes: number
878 ): void => {
879 this.deviceCopyToGPU(from, to, toOffset, nbytes);
880 };
881 } else if (name == "deviceCopyFromGPU") {
882 return (
883 from: GPUPointer,
884 fromOffset: number,
885 to: Pointer,
886 nbytes: number
887 ): void => {
888 this.deviceCopyFromGPU(from, fromOffset, to, nbytes);
889 };
890 } else if (name == "deviceCopyWithinGPU") {
891 return (
892 from: GPUPointer,
893 fromOffset: number,
894 to: Pointer,
895 toOffset: number,
896 nbytes: number
897 ): void => {
898 this.deviceCopyWithinGPU(from, fromOffset, to, toOffset, nbytes);
899 };
900 } else {
901 throw new Error("Unknown DeviceAPI function " + name);
902 }
903 }
904
905 // DeviceAPI
906 private deviceAllocDataSpace(nbytes: number): GPUPointer {

Callers 1

initWebGPUMethod · 0.95

Calls 5

deviceAllocDataSpaceMethod · 0.95
deviceFreeDataSpaceMethod · 0.95
deviceCopyToGPUMethod · 0.95
deviceCopyFromGPUMethod · 0.95
deviceCopyWithinGPUMethod · 0.95

Tested by

no test coverage detected