Skip to content

Commit 4949b56

Browse files
committed
feat(FR-1944): support 'tt-n300' accel. in the session launcher (#5105)
Resolves #5100 ([FR-1944](https://lablup.atlassian.net/browse/FR-1944)) # Add support for Tenstorrent TT-N300 accelerator This PR adds support for the Tenstorrent TT-N300 accelerator device to [Backend.AI](http://Backend.AI). The implementation includes: - Adding a new device type `tt-n300.device` to the known accelerator resource slot names - Creating a new Tenstorrent icon component and SVG asset - Adding device metadata for the TT-N300 with appropriate display settings - Updating resource broker components to recognize and handle the new device type - Adding the device to the client-side resource tracking Test: [session launcher url](http://127.0.0.1:9081/session/start?formValues=%7B%22sessionType%22%3A%22interactive%22%2C%22sessionName%22%3A%22%22%2C%22bootstrap_script%22%3A%22%22%2C%22environments%22%3A%7B%22environment%22%3A%22cr.backend.ai%2Ftesting%2Ffilebrowser%22%2C%22version%22%3A%22cr.backend.ai%2Ftesting%2Ffilebrowser%3A22.03-ubuntu20.04%40x86_64%22%2C%22manual%22%3A%22%22%7D%2C%22resourceGroup%22%3A%22tt%22%2C%22allocationPreset%22%3A%22custom%22%2C%22resource%22%3A%7B%22cpu%22%3A1%2C%22mem%22%3A%220.3125g%22%2C%22shmem%22%3A%2264m%22%2C%22accelerator%22%3A1%2C%22acceleratorType%22%3A%22tt-n300.device%22%7D%2C%22enabledAutomaticShmem%22%3Atrue%2C%22num_of_sessions%22%3A1%2C%22cluster_mode%22%3A%22single-node%22%2C%22cluster_size%22%3A1%2C%22hpcOptimization%22%3A%7B%22autoEnabled%22%3Atrue%7D%2C%22mount_id_map%22%3A%7B%7D%2C%22vfoldersNameMap%22%3A%7B%7D%2C%22mount_ids%22%3A%5B%5D%2C%22ports%22%3A%5B%5D%2C%22agent%22%3A%22auto%22%2C%22envvars%22%3A%5B%5D%7D&step=4) ![image.png](https://app.graphite.com/user-attachments/assets/7d276584-7ea5-4df2-98ec-fd409787cccd.png) ![image.png](https://app.graphite.com/user-attachments/assets/9206e4cf-397e-40c0-8818-2a439ed2f39a.png) **Checklist:** - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after [FR-1944]: https://lablup.atlassian.net/browse/FR-1944?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent e7ef1df commit 4949b56

10 files changed

Lines changed: 70 additions & 1 deletion

File tree

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"backendaiwebui",
3030
"baseversion",
3131
"Blocklist",
32-
"inactivelist",
3332
"cooldown",
3433
"cssinjs",
3534
"cuda",
@@ -43,6 +42,7 @@
4342
"Gaudi",
4443
"hoverable",
4544
"Hyperaccel",
45+
"inactivelist",
4646
"inmemory",
4747
"keypair",
4848
"Keypairs",
@@ -65,6 +65,7 @@
6565
"superadmin",
6666
"Talkativot",
6767
"Tensorboard",
68+
"tenstorrent",
6869
"textbox",
6970
"Totp",
7071
"upsert",

packages/backend.ai-ui/src/components/BAIResourceNumberWithIcon.stories.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ const mockDeviceMetaData: DeviceMetaData = {
126126
number_format: { binary: false, round_length: 0 },
127127
display_icon: 'hyperaccel',
128128
},
129+
// TT-N300
130+
'tt-n300.device': {
131+
slot_name: 'tt-n300.device',
132+
description: 'Tenstorrent TT-N300',
133+
human_readable_name: 'TT-N300',
134+
display_unit: 'TT-N300',
135+
number_format: { binary: false, round_length: 0 },
136+
display_icon: 'tenstorrent',
137+
},
129138
};
130139

131140
const meta: Meta<typeof BAIResourceNumberWithIcon> = {
@@ -317,6 +326,11 @@ export const ResourceTypes: Story = {
317326
<span style={{ width: 160 }}>Hyperaccel LPU:</span>
318327
<BAIResourceNumberWithIcon type="hyperaccel-lpu.device" value="4" />
319328
</BAIFlex>
329+
{/* Tenstorrent */}
330+
<BAIFlex gap="sm" align="center">
331+
<span style={{ width: 160 }}>Tenstorrent TT-N300:</span>
332+
<BAIResourceNumberWithIcon type="tt-n300.device" value="2" />
333+
</BAIFlex>
320334
</BAIFlex>
321335
),
322336
};

packages/backend.ai-ui/src/components/BAIResourceNumberWithIcon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import BAIGaudiIcon from '../icons/BAIGaudiIcon';
55
import BAIIpuIcon from '../icons/BAIIpuIcon';
66
import BAIRebelIcon from '../icons/BAIRebelIcon';
77
import BAIRocmIcon from '../icons/BAIRocmIcon';
8+
import BAITenstorrentIcon from '../icons/BAITenstorrentIcon';
89
import BAITpuIcon from '../icons/BAITpuIcon';
910
import BAIFlex from './BAIFlex';
1011
import NumberWithUnit from './BAINumberWithUnit';
@@ -118,6 +119,7 @@ const knownDeviceIcons = {
118119
nvidia: <BAINvidiaIcon />,
119120
rocm: <BAIRocmIcon />,
120121
rebel: <BAIRebelIcon />,
122+
tenstorrent: <BAITenstorrentIcon />,
121123
} as const;
122124

123125
interface ResourceTypeIconProps {

packages/backend.ai-ui/src/components/provider/BAIMetaDataProvider/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const knownAcceleratorResourceSlotNames = [
1919
'warboy.device',
2020
'rngd.device',
2121
'hyperaccel-lpu.device',
22+
'tt-n300.device',
2223
] as const;
2324
export type KnownAcceleratorResourceSlotName =
2425
(typeof knownAcceleratorResourceSlotNames)[number];
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { default as logo } from './tenstorrent.svg?react';
2+
import Icon from '@ant-design/icons';
3+
import { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon';
4+
5+
interface BAITenstorrentIconProps
6+
extends Omit<CustomIconComponentProps, 'width' | 'height' | 'fill'> {
7+
'aria-label'?: string;
8+
}
9+
10+
const BAITenstorrentIcon: React.FC<BAITenstorrentIconProps> = ({
11+
'aria-label': ariaLabel = 'tenstorrent',
12+
...props
13+
}) => {
14+
return <Icon component={logo} aria-label={ariaLabel} {...props} />;
15+
};
16+
17+
export default BAITenstorrentIcon;
Lines changed: 8 additions & 0 deletions
Loading

react/src/components/ConfigurationsSettingList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const resourcesSlots: {
7878
'warboy.device': 'warboy',
7979
'rngd.device': 'rngd',
8080
'hyperaccel-lpu.device': 'hyperaccel_lpu',
81+
'tt-n300.device': 'tt_n300',
8182
};
8283

8384
const ConfigurationsSettingList = () => {

react/src/hooks/backendai.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const knownAcceleratorResourceSlotNames = [
3232
'warboy.device',
3333
'rngd.device',
3434
'hyperaccel-lpu.device',
35+
'tt-n300.device',
3536
] as const;
3637
export type KnownAcceleratorResourceSlotName =
3738
(typeof knownAcceleratorResourceSlotNames)[number];

resources/device_metadata.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@
154154
"round_length": 0
155155
},
156156
"display_icon": "lpu"
157+
},
158+
"tt-n300.device": {
159+
"slot_name": "tt-n300.device",
160+
"description": "Tenstorrent N300",
161+
"human_readable_name": "Tenstorrent N300 Device",
162+
"display_unit": "N300",
163+
"number_format": {
164+
"binary": false,
165+
"round_length": 0
166+
},
167+
"display_icon": "tenstorrent"
157168
}
158169
}
159170
}

src/lib/backend.ai-client-esm.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4027,6 +4027,9 @@ class Resources {
40274027
this.resources['hyperaccel-lpu.device'] = {};
40284028
this.resources['hyperaccel-lpu.device'].total = 0;
40294029
this.resources['hyperaccel-lpu.device'].used = 0;
4030+
this.resources['tt-n300.device'] = {};
4031+
this.resources['tt-n300.device'].total = 0;
4032+
this.resources['tt-n300.device'].used = 0;
40304033

40314034
this.resources.agents = {};
40324035
this.resources.agents.total = 0;
@@ -4212,6 +4215,16 @@ class Resources {
42124215
parseInt(this.resources['hyperaccel-lpu.device'].used) +
42134216
Math.floor(Number(occupied_slots['hyperaccel-lpu.device']));
42144217
}
4218+
if ('tt-n300.device' in available_slots) {
4219+
this.resources['tt-n300.device'].total =
4220+
parseInt(this.resources['tt-n300.device'].total) +
4221+
Math.floor(Number(available_slots['tt-n300.device']));
4222+
}
4223+
if ('tt-n300.device' in occupied_slots) {
4224+
this.resources['tt-n300.device'].used =
4225+
parseInt(this.resources['tt-n300.device'].used) +
4226+
Math.floor(Number(occupied_slots['tt-n300.device']));
4227+
}
42154228

42164229
if (isNaN(this.resources.cpu.used)) {
42174230
this.resources.cpu.used = 0;

0 commit comments

Comments
 (0)