[BUG] Assert in llvm_util.cpp validate_struct_data_layout using batched mode and LLVM 21.1.x
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
src/liboslexec/llvm_util.cpp の validate_struct_data_layout から始め、batched モード、OIIO 2.5.18.0、LLVM 21.1.x、および報告された shader で assertion を再現します。LLVM 19.1.7 と struct layout の挙動を比較し、期待される offset と実際の offset を調査します。報告された構成で assertion が発生しなくなり、layout の検証が引き続き正しい状態であれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Note: The prompts below are just to help you formulate a good and actionable
request. Feel free to deviate from this format or to delete this text and
write free-form if you prefer.
Describe the bug
When using OSL in batched mode eg. in GafferOSL's OSLObject, an assertion happens in validate_struct_data_layout:
https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/b3c601f291a9fedf4c43f311fe7224c3b2d073ea/src/liboslexec/llvm_util.cpp#L1797
I saw the OSL_DEV definition is one mechanism to print out the values and see where it differs which I tried, however I ran into an issue where TextureOpt's envlayout is now private so that codepath doesn't quite work anymore without modification (and risk not getting the right information to debug the original issue...)
OSL version and dependencies
- OSL branch/version: tagged 1.14.8.0 and 1.14.10.0 tested
- OS: Windows 11
- C++ compiler: MSVC 14.44 (v143 toolkit with
-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) - LLVM version: 21.1.3 and 21.1.8 tested (not an issue with 19.1.7)
- OIIO version: 2.5.18.0
- Architecture: x86_64 Ryzen 7 6800M CPU (Zen3) so most likely using AVX2 in batched mode.
To Reproduce
Steps to reproduce the behavior:
- On Windows it is the combination of OIIO 2.5.18.0, LLVM 21.1.3, OSL 1.14.10.0
- For OSL it is built with:
USE_BATCHED="b8_AVX,b8_AVX2,b8_AVX2_noFMA,b8_AVX512,b8_AVX512_noFMA,b16_AVX512,b16_AVX512_noFMA"(default for Gaffer builds on Linux, not on Windows yet) - Create a basic OSLObject or something that uses batched mode.
- Assert! In
validate_struct_data_layoutcall ofliboslexec/llvm_util.cpp
Evidence
C:\dev\rpks\osl\1.14.10.0\build\osl\src\liboslexec\llvm_util.cpp:1797: void __cdecl OSL::v1_14::pvt::LLVM_Util::validate_struct_data_layout(class llvm::Type *,const class std::vector<unsigned int,class std::allocator<unsigned int> > &): Assertion 'expected_offset_by_index[index] == actual_offset' failed.
int i;
getattribute( "shading:index", i );
output1 = 0.1 * hashnoise( i );
IF YOU ALREADY HAVE A CODE FIX: Not yet but this is a fairly obscure combination mix that I don't expect someone else to reproduce easily, so I'm willing to understand things better so I can help make a fix. I can also check Linux later to see if it happens there. The big suspect is an LLVM change that has been made between 19 and 21 that's not being taken into account here somewhere.
- 主要言語
- C++
- スター
- 2.3k
- フォーク
- 414
- 平均マージ
- 2日 14時間
- マージ済み PR(30日)
- 13
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AcademySoftwareFoundation/OpenShadingLanguage のほかの issue
-
build / testing / port / CI
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AcademySoftwareFoundation/OpenShadingLanguage#2148 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AcademySoftwareFoundation/OpenShadingLanguage#2109 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
AcademySoftwareFoundation/OpenShadingLanguage#2175 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
AcademySoftwareFoundation/OpenShadingLanguage#2146 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
AcademySoftwareFoundation/OpenShadingLanguage#2135 ·
メンテナーはふだん 1 日以内に返信
AcademySoftwareFoundation/OpenShadingLanguage の issue をすべて見る
似ている issue
-
難易度 2/5 半日 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
ROCm/rocm-libraries#12703 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
isl-org/Open3D#7585 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
qbittorrent/qBittorrent#24975 ·
メンテナーはふだん 3 日以内に返信