---
title: "init(device:)"
framework: metalperformanceshaders
role: symbol
role_heading: Initializer
path: "metalperformanceshaders/mpskernel/init(device:)"
---

# init(device:)

Initializes a new kernel object.

## Declaration

```swift
init(device: any MTLDevice)
```

## Parameters

- `device`: The Metal device on which the kernel will be used.

## Mentioned in

The MPSKernel Class

## Return Value

Return Value An initialized kernel object.

## Discussion

Discussion This method fails if the device is not supported. Query the MPSSupportsMTLDevice(_:) function to determine whether the device is supported.

## See Also

### Methods

- [copy(with:device:)](metalperformanceshaders/mpskernel/copy(with:device:).md)
