-
Notifications
You must be signed in to change notification settings - Fork 173
fix: aiecc --aiesim crashes due to missing define and wrong IO backend #2956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,64 @@ | ||||||||
| /* | ||||||||
| * Weak stubs for aiesimulator ESS functions. | ||||||||
| * | ||||||||
| * xaie_sim.c forward-declares these symbols (ess_Write32, ess_Read32, etc.) | ||||||||
| * which are provided at runtime by the aiesimulator SystemC process via | ||||||||
| * dlopen. When linking aiecc statically, these symbols are unresolved. | ||||||||
| * | ||||||||
| * These weak definitions satisfy the linker. If aiecc is loaded by | ||||||||
| * aiesimulator, the real (strong) symbols override them. If someone | ||||||||
| * calls aiecc --aiesim outside of aiesimulator, the sim backend init | ||||||||
| * will fail gracefully before these are reached, but the stubs abort() | ||||||||
| * as a safety net. | ||||||||
| * | ||||||||
| * This file is licensed under the Apache License v2.0 with LLVM Exceptions. | ||||||||
| * See https://llvm.org/LICENSE.txt for license information. | ||||||||
| * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||||||
| * | ||||||||
| * (c) Copyright 2026 Advanced Micro Devices, Inc. | ||||||||
| */ | ||||||||
|
|
||||||||
| #include <stdint.h> | ||||||||
| #include <stdio.h> | ||||||||
| #include <stdlib.h> | ||||||||
|
|
||||||||
| typedef unsigned int uint; | ||||||||
|
|
||||||||
| __attribute__((weak)) void ess_Write32(uint64_t Addr, uint Data) { | ||||||||
|
Check failure on line 27 in runtime_lib/ess_stubs.c
|
||||||||
| (void)Addr; | ||||||||
|
Check failure on line 28 in runtime_lib/ess_stubs.c
|
||||||||
| (void)Data; | ||||||||
|
Check failure on line 29 in runtime_lib/ess_stubs.c
|
||||||||
| fprintf(stderr, "FATAL: ess_Write32 called outside aiesimulator\n"); | ||||||||
| abort(); | ||||||||
| } | ||||||||
|
|
||||||||
| __attribute__((weak)) uint ess_Read32(uint64_t Addr) { | ||||||||
|
Check failure on line 34 in runtime_lib/ess_stubs.c
|
||||||||
| (void)Addr; | ||||||||
| fprintf(stderr, "FATAL: ess_Read32 called outside aiesimulator\n"); | ||||||||
| abort(); | ||||||||
| } | ||||||||
|
Comment on lines
+34
to
+39
|
||||||||
|
|
||||||||
| __attribute__((weak)) void | ||||||||
| ess_WriteCmd(unsigned char Command, unsigned char ColId, unsigned char RowId, | ||||||||
| unsigned int CmdWd0, unsigned int CmdWd1, unsigned char *CmdStr) { | ||||||||
| (void)Command; | ||||||||
| (void)ColId; | ||||||||
| (void)RowId; | ||||||||
| (void)CmdWd0; | ||||||||
| (void)CmdWd1; | ||||||||
| (void)CmdStr; | ||||||||
| fprintf(stderr, "FATAL: ess_WriteCmd called outside aiesimulator\n"); | ||||||||
| abort(); | ||||||||
| } | ||||||||
|
|
||||||||
| __attribute__((weak)) void ess_NpiWrite32(uint64_t Addr, uint Data) { | ||||||||
| (void)Addr; | ||||||||
| (void)Data; | ||||||||
| fprintf(stderr, "FATAL: ess_NpiWrite32 called outside aiesimulator\n"); | ||||||||
| abort(); | ||||||||
| } | ||||||||
|
|
||||||||
| __attribute__((weak)) uint ess_NpiRead32(uint64_t Addr) { | ||||||||
| (void)Addr; | ||||||||
| fprintf(stderr, "FATAL: ess_NpiRead32 called outside aiesimulator\n"); | ||||||||
| abort(); | ||||||||
|
||||||||
| abort(); | |
| abort(); | |
| __builtin_unreachable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target_compile_definitions()should be given bare preprocessor symbols (e.g.__AIECDO__) rather than-D.... Passing-D__AIECDO__causes CMake to emit an extra-Dprefix (typically-D-D__AIECDO__), which can break compilation and is inconsistent with other CMake files in this repo (e.g.runtime_lib/xaiengine/lib/CMakeLists.txt).