accel-sim / accel-sim-framework

This is the top-level repository for the Accel-Sim framework.
https://accel-sim.github.io
Other
294 stars 114 forks source link

Bison error at ptx_parser_decode.def #319

Closed mahmoodn closed 2 months ago

mahmoodn commented 3 months ago

I am using a modified version of Accelsim which was fine with GCC-9.4 and CUDA 11.6 (driver and toolkit). Recently, I have upgraded the system with CUDA 12.2 (driver) and 11.6 (toolkit) and I was able to compile the latest version of Accelsim with GCC-9.5.

However, when I want to compile my own version with the same configuration, I get an error message in the early compilation process:

bison --name-prefix=ptx_ -v -d ptx.y --file-prefix=/home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx
ptx.y: warning: 1 nonterminal useless in grammar [-Wother]
ptx.y: warning: 2 rules useless in grammar [-Wother]
ptx.y:573.1-7: warning: nonterminal useless in grammar: vp_spec [-Wother]
  573 | vp_spec: WMMA_DIRECTIVE LAYOUT CONFIGURATION{recognizer->add_space_spec(global_space,0);recognizer->add_ptr_spec(global_space)...
      | ^~~~~~~
ptx.y: warning: 57 reduce/reduce conflicts [-Wconflicts-rr]
ptx.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
ptx.y:277.11-112: warning: rule useless in parser due to conflicts [-Wother]
  277 |         | WEAK_DIRECTIVE FUNC_DIRECTIVE { $$ = 0; recognizer->g_func_decl=1; recognizer->func_header(".func"); }
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cat /home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx.tab.h | grep "=" | sed 's/^[ ]\+//' | sed 's/[=,]//g' | sed 's/\([_A-Z1-9]\+\)[ ]\+\([0-9]\+\)/\1 \1/' | sed 's/^/DEF(/' | sed 's/ /,"/' | sed 's/$/")/' > /home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx_parser_decode.def
g++  -c -O3 -g3 -Wall -Wno-unused-function -Wno-sign-compare -I/usr/local/cuda-11.6/include  -I/home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ -I. -I/home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release -fPIC  -DTRACING_ON=1 -DCUDART_VERSION=11060 -std=c++0x ptx_parser.cc -o /home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx_parser.o
In file included from ptx_parser.h:32,
                 from ptx_parser.cc:29:
../abstract_hardware_model.h: In member function ‘virtual void inst_t::print_insn(FILE*) const’:
../abstract_hardware_model.h:1023:17: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘address_type’ {aka ‘long long unsigned int’} [-Wformat=]
 1023 |     fprintf(fp, " [inst @ pc=0x%04x] ", pc);
      |                 ^~~~~~~~~~~~~~~~~~~~~~  ~~
      |                                         |
      |                                         address_type {aka long long unsigned int}
In file included from ptx_parser.h:32,
                 from ptx_parser.cc:29:
../abstract_hardware_model.h: In member function ‘virtual void warp_inst_t::print_insn(FILE*) const’:
../abstract_hardware_model.h:1217:17: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘address_type’ {aka ‘long long unsigned int’} [-Wformat=]
 1217 |     fprintf(fp, " [inst @ pc=0x%04x] ", pc);
      |                 ^~~~~~~~~~~~~~~~~~~~~~  ~~
      |                                         |
      |                                         address_type {aka long long unsigned int}
In file included from ../../libcuda/../src/cuda-sim/cuda-sim.h:37,
                 from ../../libcuda/gpgpu_context.h:3,
                 from ptx_parser.cc:30:
../../libcuda/../src/cuda-sim/../gpgpu-sim/shader.h: In constructor ‘scheduler_unit::scheduler_unit(shader_core_stats*, shader_core_ctx*, Scoreboard*, simt_stack**, std::vector<shd_warp_t*>*, register_set*, register_set*, register_set*, register_set*, register_set*, std::vector<register_set*>&, register_set*, int)’:
../../libcuda/../src/cuda-sim/../gpgpu-sim/shader.h:450:32: warning: ‘scheduler_unit::m_spec_cores_out’ will be initialized after [-Wreorder]
  450 |   std::vector<register_set *> &m_spec_cores_out;
      |                                ^~~~~~~~~~~~~~~~
../../libcuda/../src/cuda-sim/../gpgpu-sim/shader.h:449:17: warning:   ‘register_set* scheduler_unit::m_mem_out’ [-Wreorder]
  449 |   register_set *m_mem_out;
      |                 ^~~~~~~~~
../../libcuda/../src/cuda-sim/../gpgpu-sim/shader.h:344:3: warning:   when initialized here [-Wreorder]
  344 |   scheduler_unit(shader_core_stats *stats, shader_core_ctx *shader,
      |   ^~~~~~~~~~~~~~
/home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx_parser_decode.def: In member function ‘symbol_table* gpgpu_context::init_parser(const char*)’:
/home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx_parser_decode.def:2:11: error: unable to find string literal operator ‘operator""end’ with ‘const char [30]’, ‘long unsigned int’ arguments
    2 | DEF(YYEOF,"YYEOF                     /* "end of file"  */")
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ptx_parser.cc:115:43: note: in definition of macro ‘DEF’
  115 | #define DEF(X, Y) g_ptx_token_decode[X] = Y;
      |                                           ^
/home/mahmood/accelsim-chiplet/gpu-simulator/gpgpu-sim/build/gcc-9.5.0/cuda-11060/release/cuda-sim/ptx_parser_decode.def:4:13: error: unable to find string literal operator ‘operator""invalid’ with ‘const char [28]’, ‘long unsigned int’ arguments
    4 | DEF(YYUNDEF,"YYUNDEF                 /* "invalid token"  */")
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ptx_parser.cc:115:43: note: in definition of macro ‘DEF’
  115 | #define DEF(X, Y) g_ptx_token_decode[X] = Y;
      |                                           ^

I have to say that my modifications had nothing to do with the PTX section. I also tried to understand and find the source code that causes this error. However, it seems that files like ptx_parser_decode.def are part of the bison process which are created by interpreting some other files. I mean there is no line DEF(YYUNDEF,"YYUNDEF /* "invalid token" */") in the source code.

I was wondering if that error is related to GCC or CUDA? As I said, I was able to compile the latest Accelsim version with CUDA-12 (driver) and 11.6 (toolkit).

Any thought on that?

JRPan commented 3 months ago

https://github.com/accel-sim/gpgpu-sim_distribution/pull/42