Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dkms.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PACKAGE_NAME=aws-neuronx
PACKAGE_VERSION=2.28.0.0
PACKAGE_VERSION=2.29.0.0
BUILT_MODULE_NAME[0]="neuron"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean"
Expand Down
17 changes: 17 additions & 0 deletions neuron_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,20 @@ int narch_get_instance_type_name(char *instance_type_name, size_t instance_type_
return -ENOSYS;
#endif
}

enum neuron_platform_type narch_detect_platform_type(const struct neuron_platform_lookup *table) {
char buf[128];
int i;

if (narch_get_instance_type_name(buf, sizeof(buf))) {
return NEURON_PLATFORM_TYPE_STD;
}

for (i = 0; table[i].inst_name != NULL; i++) {
if (strncmp(buf, table[i].inst_name, strlen(table[i].inst_name)) == 0) {
return table[i].platform_type;
}
}

return NEURON_PLATFORM_TYPE_STD;
}
15 changes: 15 additions & 0 deletions neuron_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ enum neuron_platform_type {
NEURON_PLATFORM_TYPE_STD = 0,
NEURON_PLATFORM_TYPE_ULTRASERVER = 1,
NEURON_PLATFORM_TYPE_PDS = 2,
NEURON_PLATFORM_TYPE_MAX = 3,
NEURON_PLATFORM_TYPE_INVALID,
};

struct neuron_platform_lookup {
const char *inst_name;
enum neuron_platform_type platform_type;
};

enum neuron_platform_operation_type {
NEURON_PLATFORM_OP_TYPE_DEVOPEN = 0,
NEURON_PLATFORM_OP_TYPE_EXEC = 1,
Expand Down Expand Up @@ -83,4 +89,13 @@ bool narch_is_emu(void);
*/
int narch_get_instance_type_name(char *instance_type_name, size_t instance_type_name_size);

/**
* narch_detect_platform_type() - Detect platform type from instance name.
*
* @table: Array of instance name to platform type mappings.
*
* Return: Matching platform type, or NEURON_PLATFORM_TYPE_STD if no match.
*/
enum neuron_platform_type narch_detect_platform_type(const struct neuron_platform_lookup *table);

#endif
Loading