snu-sf-class / swpp202401

Principles and Practices of Software Development Main Repository
13 stars 4 forks source link

[Project] interpreter 관련 질문입니다. #120

Open tnsqjahong opened 1 month ago

tnsqjahong commented 1 month ago

만든 패스의 효율을 테스트하기 위해 인터프리터를 실행중에 에러가 생겼습니다. 아래는 에러 로그입니다.

cargo run --release -- script/assem_optimized/matmul4.s < script/assem_optimized/matmul4/input2.txt
    Finished release [optimized] target(s) in 0.02s
     Running `target/release/main script/assem_optimized/matmul4.s`
Your assembly fails with following Error
While running matmul, following error occurs 
-------------------------------------------------
 While running copy_mask, following error occurs 
-------------------------------------------------
 Block for.end isn't declared : line 79 
-------------------------------------------------
 : line 2104 
-------------------------------------------------
 : line 2246
thread 'main' panicked at src/bin/main.rs:37:9:
explicit panic

에러는 79번째 라인에서 for.end를 못 찾았다고 나오는데 어셈블리코드에서는 101번째 라인에 for.end가 선언되어있습니다. 아래는 문제가 생긴 어셈블리 파일입니다.

078: .for.inc.3:
079: br r6 .for.body6.4 .for.end
080: .for.body6.4:
081: r1 = add arg2 r6 32
082: r1 = mul r1 arg1 32
083: r1 = add r1 arg3 32
084: r1 = add r1 r7 32
085: r1 = mul r1 r2 64
086: r1 = add arg4 r1 64
087: r1 = load 8 r1
088: r3 = mul r6 r7 32
089: r3 = add r3 r7 32
090: r3 = shl r3 r8 64
091: r3 = ashr r3 r8 64
092: r2 = mul r3 r2 64
093: r2 = add arg5 r2 64
094: store 8 r1 r2
095: br .for.inc.4
096: .for.inc.4:
097: ; unreachable
098: r1 = const 0
099: assert_eq r1 1
100: br .for.inc.4
101: .for.end:
102: br .for.inc17
103: .for.inc17:

혹시 어떤 이유에서 이런 에러가 나오는지 확인 가능할까요?

감사합니다

Hyun2023 commented 1 month ago

안녕하세요. 혹시 문제가 발생한 어셈블리 전체와 테스트 케이스를 올려주시거나 TA 메일로 보내주실 수 있으신가요?

tnsqjahong commented 1 month ago

안녕하세요 조교님 인터프리터 관련 질문 올렸던 홍순범입니다.

제가 사용한 어셈블리파일과 테스트 인풋 보내드립니다. 테스트중에서 1번째는 에러가 없는데 2번째부터 에러가 생깁니다.

참고를 위해 알려드리자면 추가한 패스는 loop unrolling하는 내용입니다. 사용한 테스트는 벤치마크에 있던 matmul4와 동일합니다.

늦은 시간에도 바로 답장주셔서 감사합니다!

      1. 오후 10:04, Hyunwoo Lee @.***> 작성:

안녕하세요. 혹시 문제가 발생한 어셈블리 전체와 테스트 케이스를 올려주시거나 TA 메일로 보내주실 수 있으신가요?

— Reply to this email directly, view it on GitHub https://github.com/snu-sf-class/swpp202401/issues/120#issuecomment-2127055693, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMRNBZ635Y6ETXK6RKEG42TZDXSNLAVCNFSM6AAAAABIFS4HSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRXGA2TKNRZGM. You are receiving this because you authored the thread.

Hyun2023 commented 1 month ago

제대로 전달이 안된것 같습니다. 제 깃헙계정말고 소개원실 TA메일로 전달 부탁드리겠습니다.

Hyun2023 commented 1 month ago

어셈블리 코드가 주석을 포함했을때 파싱이 중간에 멈추는 문제가 있었습니다. 최신 패치에서 수정되었습니다.