Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

지원되는 RUSTFLAGS

디버깅이나 프로파일링을 돕기 위해 실험적인 -Z autodiff rustc 플래그를 지원하도록 추가했습니다. 이 플래그는 RUSTFLAGS를 통해 cargo에 전달할 수 있으며, rustc를 다시 컴파일하지 않고도 Enzyme의 동작을 변경할 수 있게 해 줍니다. 현재 autodiff에 대해 다음 값을 지원합니다.

디버그 플래그

PrintTA // Print TypeAnalysis information
PrintTAFn // Print TypeAnalysis information for a specific function
PrintAA // Print ActivityAnalysis information
Print // Print differentiated functions while they are being generated and optimized
PrintPerf // Print AD related Performance warnings
PrintModBefore // Print the whole LLVM-IR module directly before running AD
PrintModAfter // Print the whole LLVM-IR module after running AD, before optimizations
PrintModFinal // Print the whole LLVM-IR module after running optimizations and AD
LooseTypes // Risk incorrect derivatives instead of aborting when missing Type Info 

LooseTypes는 Can not deduce type of <X>라는 Enzyme 오류를 없애고 일부 코드를 실행할 수 있게 하는 데 유용한 경우가 많습니다. 하지만 이 플래그는 잘못된 그레이디언트를 만들어 낼 가능성이 분명히 있다는 점을 유의하십시오. 더 나쁜 것은, 그레이디언트가 특정 입력값에서는 올바르지만 다른 입력값에서는 올바르지 않을 수도 있다는 점입니다. 그러므로 이러한 버그는 이슈로 등록하시고, 이 플래그는 버그가 수정되기를 기다리는 동안에만 임시로 사용하십시오.

벤치마크 플래그

성능 실험과 벤치마킹을 위해 다음 값도 지원합니다.

NoPostopt // We won't optimize the LLVM-IR Module after AD
RuntimeActivity // Enables the runtime activity feature from Enzyme 
Inline // Instructs Enzyme to maximize inlining as far as possible, beyond LLVM's default

쉼표를 구분자로 사용하여 여러 autodiff 값을 조합할 수 있습니다:

RUSTFLAGS="-Z autodiff=Enable,LooseTypes,PrintPerf" cargo +enzyme build

-Zautodiff=Enable을 사용하면 autodiff를 사용할 수 있게 되며, 일반적인 rustc 컴파일 파이프라인이 다음과 같이 바뀝니다:

  1. 선택한 컴파일 파이프라인을 실행합니다. 릴리스 빌드를 선택한 경우, 벡터화와 루프 언롤링을 비활성화합니다.
  2. 함수를 미분합니다.
  3. 선택한 컴파일 파이프라인을 모듈 전체에 대해 다시 실행합니다. 이번에는 벡터화나 루프 언롤링을 비활성화하지 않습니다.