Skip to main content
torch.js has not been released yet.
torch.js logotorch.js logotorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
Introduction
createBufferUsageMapModeWGPUBufferWGPUShaderModuleWGPUBindGroupLayoutWGPUBindGroupWGPUComputePipelineWGPUQuerySetWGPUComputePassEncoderWGPUCommandBufferWGPUCommandEncoderWGPUQueueWGPULimitsBufferDescriptorShaderModuleDescriptorComputePipelineDescriptorBufferBindingBindGroupEntryBindGroupDescriptorQuerySetDescriptorWGPUDeviceWGPUSupportedFeaturesWGPUAdapterWGPU
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. wgpu-native
  3. wgpu-native
  4. WGPUDevice

wgpu-native.WGPUDevice

export interface WGPUDevice {
  /**
   * The command queue for this device.
   * Used to submit command buffers and write data.
   */
  readonly queue: WGPUQueue;

  /**
   * Device capabilities and limits.
   */
  readonly limits: WGPULimits;

  /**
   * Supported optional features on this device.
   */
  readonly features: WGPUSupportedFeatures;

  /**
   * Opaque native handle to this device.
   */
  readonly handle: DeviceHandle;

  /**
   * Create a GPU buffer.
   *
   * @param descriptor - Buffer creation parameters
   * @returns A new GPU buffer
   */
  createBuffer(descriptor: BufferDescriptor): WGPUBuffer;

  /**
   * Create a shader module from WGSL source.
   *
   * @param descriptor - Shader creation parameters
   * @returns A compiled shader module
   */
  createShaderModule(descriptor: ShaderModuleDescriptor): WGPUShaderModule;

  /**
   * Create a compute pipeline.
   *
   * @param descriptor - Pipeline creation parameters
   * @returns A compute pipeline ready for dispatch
   */
  createComputePipeline(descriptor: ComputePipelineDescriptor): WGPUComputePipeline;

  /**
   * Create a bind group.
   *
   * @param descriptor - Bind group creation parameters
   * @returns A bind group for resource binding
   */
  createBindGroup(descriptor: BindGroupDescriptor): WGPUBindGroup;

  /**
   * Create a command encoder for recording commands.
   *
   * @returns A command encoder
   */
  createCommandEncoder(): WGPUCommandEncoder;

  /**
   * Create a query set for profiling.
   *
   * @param descriptor - Query set creation parameters
   * @returns A query set
   */
  createQuerySet(descriptor: QuerySetDescriptor): WGPUQuerySet;

  /**
   * Destroy this device and free all resources.
   */
  destroy(): void;

  /**
   * Poll the device for pending operations.
   *
   * @param wait - If true, blocks until work is completed
   */
  poll(wait?: boolean): void;
}
readonlyqueue(WGPUQueue)
– The command queue for this device. Used to submit command buffers and write data.
readonlylimits(WGPULimits)
– Device capabilities and limits.
readonlyfeatures(WGPUSupportedFeatures)
– Supported optional features on this device.
readonlyhandle(DeviceHandle)
– Opaque native handle to this device.
createBuffer((descriptor: BufferDescriptor) => WGPUBuffer)
– Create a GPU buffer.
createShaderModule((descriptor: ShaderModuleDescriptor) => WGPUShaderModule)
– Create a shader module from WGSL source.
createComputePipeline((descriptor: ComputePipelineDescriptor) => WGPUComputePipeline)
– Create a compute pipeline.
createBindGroup((descriptor: BindGroupDescriptor) => WGPUBindGroup)
– Create a bind group.
createCommandEncoder(() => WGPUCommandEncoder)
– Create a command encoder for recording commands.
createQuerySet((descriptor: QuerySetDescriptor) => WGPUQuerySet)
– Create a query set for profiling.
destroy(() => void)
– Destroy this device and free all resources.
poll((wait?: boolean) => void)
– Poll the device for pending operations.

GPU device.

The main interface for creating GPU resources and submitting work. A device is obtained from an adapter via WGPUAdapter.requestDevice.

Previous
WGPUComputePipeline
Next
WGPULimits