Table of Contents

Class VendorAdapterFactory

Namespace
DotCompute.Backends.OpenCL.Vendor
Assembly
DotCompute.Backends.OpenCL.dll

Factory for creating vendor-specific adapters based on platform detection.

public static class VendorAdapterFactory
Inheritance
VendorAdapterFactory
Inherited Members

Remarks

The factory maintains a registry of all supported vendor adapters and selects the appropriate one based on platform characteristics. Adapters are tried in priority order, with the generic fallback ensuring we always have a valid adapter.

Adapter priority:

  1. NVIDIA - Most common for compute workloads
  2. AMD - Growing compute presence
  3. Intel - Expanding with Arc discrete GPUs
  4. Generic - Universal fallback

The factory is thread-safe and uses singleton adapter instances for efficiency.

Properties

AllAdapters

Gets all registered vendor adapters.

public static IReadOnlyList<IOpenCLVendorAdapter> AllAdapters { get; }

Property Value

IReadOnlyList<IOpenCLVendorAdapter>

A read-only collection of all vendor adapters.

Remarks

This method is primarily for testing and diagnostics. The returned collection includes the generic fallback adapter.

Methods

DetectVendor(OpenCLPlatformInfo)

Detects the vendor type from a platform.

public static OpenCLVendor DetectVendor(OpenCLPlatformInfo platform)

Parameters

platform OpenCLPlatformInfo

The OpenCL platform to analyze.

Returns

OpenCLVendor

The detected vendor type.

Remarks

This is a convenience method that returns the vendor enum rather than the full adapter instance. Useful for logging and diagnostics.

Exceptions

ArgumentNullException

Thrown if platform is null.

GetAdapter(OpenCLPlatformInfo)

Gets the appropriate vendor adapter for the specified platform.

public static IOpenCLVendorAdapter GetAdapter(OpenCLPlatformInfo platform)

Parameters

platform OpenCLPlatformInfo

The OpenCL platform to get an adapter for.

Returns

IOpenCLVendorAdapter

The vendor-specific adapter, or generic adapter as fallback.

Remarks

This method is thread-safe and deterministic. For the same platform, it will always return the same adapter type.

Exceptions

ArgumentNullException

Thrown if platform is null.

GetVendorName(OpenCLPlatformInfo)

Gets the vendor display name for a platform.

public static string GetVendorName(OpenCLPlatformInfo platform)

Parameters

platform OpenCLPlatformInfo

The OpenCL platform to query.

Returns

string

The human-readable vendor name.

Remarks

This method is useful for displaying vendor information to users in a consistent format across all vendors.

Exceptions

ArgumentNullException

Thrown if platform is null.

IsVendorSupported(OpenCLVendor)

Checks if a specific vendor is supported by the factory.

public static bool IsVendorSupported(OpenCLVendor vendor)

Parameters

vendor OpenCLVendor

The vendor to check.

Returns

bool

true if the vendor has a dedicated adapter; otherwise, false.

Remarks

This method is useful for determining if vendor-specific optimizations are available. Returns false for Unknown and Generic vendors.