-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented override for Cuda device instruction set.
- Loading branch information
Showing
5 changed files
with
114 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// --------------------------------------------------------------------------------------- | ||
// ILGPU | ||
// Copyright (c) 2023 ILGPU Project | ||
// www.ilgpu.net | ||
// | ||
// File: CudaDeviceOverride.cs | ||
// | ||
// This file is part of ILGPU and is distributed under the University of Illinois Open | ||
// Source License. See LICENSE.txt for details. | ||
// --------------------------------------------------------------------------------------- | ||
|
||
namespace ILGPU.Runtime.Cuda | ||
{ | ||
/// <summary> | ||
/// Represents overridable settings of a Cuda device. | ||
/// </summary> | ||
public sealed class CudaDeviceOverride | ||
{ | ||
/// <summary> | ||
/// The Cuda device to configure. | ||
/// </summary> | ||
public CudaDevice Device { get; } | ||
|
||
/// <summary> | ||
/// Forces the Cuda device to use the specified Instruction Set. | ||
/// </summary> | ||
public CudaInstructionSet? InstructionSet { get; set; } | ||
|
||
/// <summary> | ||
/// Constructs a new instance with the overridable settings. | ||
/// </summary> | ||
/// <param name="device">The Cuda device.</param> | ||
internal CudaDeviceOverride(CudaDevice device) | ||
{ | ||
Device = device; | ||
InstructionSet = device.InstructionSet; | ||
} | ||
|
||
/// <summary> | ||
/// Applies all the overridden settings to the Cuda device. | ||
/// </summary> | ||
internal void ApplyOverrides() | ||
{ | ||
if (InstructionSet.HasValue) | ||
Device.InstructionSet = InstructionSet; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters