convert_to_half_pass.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. // Copyright (c) 2019 The Khronos Group Inc.
  2. // Copyright (c) 2019 Valve Corporation
  3. // Copyright (c) 2019 LunarG Inc.
  4. //
  5. // Licensed under the Apache License, Version 2.0 (the "License");
  6. // you may not use this file except in compliance with the License.
  7. // You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. #include "convert_to_half_pass.h"
  17. #include "source/opt/ir_builder.h"
  18. namespace {
  19. // Indices of operands in SPIR-V instructions
  20. static const int kImageSampleDrefIdInIdx = 2;
  21. } // anonymous namespace
  22. namespace spvtools {
  23. namespace opt {
  24. bool ConvertToHalfPass::IsArithmetic(Instruction* inst) {
  25. return target_ops_core_.count(inst->opcode()) != 0 ||
  26. (inst->opcode() == SpvOpExtInst &&
  27. inst->GetSingleWordInOperand(0) ==
  28. context()->get_feature_mgr()->GetExtInstImportId_GLSLstd450() &&
  29. target_ops_450_.count(inst->GetSingleWordInOperand(1)) != 0);
  30. }
  31. bool ConvertToHalfPass::IsFloat(Instruction* inst, uint32_t width) {
  32. uint32_t ty_id = inst->type_id();
  33. if (ty_id == 0) return false;
  34. return Pass::IsFloat(ty_id, width);
  35. }
  36. bool ConvertToHalfPass::IsDecoratedRelaxed(Instruction* inst) {
  37. uint32_t r_id = inst->result_id();
  38. for (auto r_inst : get_decoration_mgr()->GetDecorationsFor(r_id, false))
  39. if (r_inst->opcode() == SpvOpDecorate &&
  40. r_inst->GetSingleWordInOperand(1) == SpvDecorationRelaxedPrecision)
  41. return true;
  42. return false;
  43. }
  44. bool ConvertToHalfPass::IsRelaxed(uint32_t id) {
  45. return relaxed_ids_set_.count(id) > 0;
  46. }
  47. void ConvertToHalfPass::AddRelaxed(uint32_t id) { relaxed_ids_set_.insert(id); }
  48. analysis::Type* ConvertToHalfPass::FloatScalarType(uint32_t width) {
  49. analysis::Float float_ty(width);
  50. return context()->get_type_mgr()->GetRegisteredType(&float_ty);
  51. }
  52. analysis::Type* ConvertToHalfPass::FloatVectorType(uint32_t v_len,
  53. uint32_t width) {
  54. analysis::Type* reg_float_ty = FloatScalarType(width);
  55. analysis::Vector vec_ty(reg_float_ty, v_len);
  56. return context()->get_type_mgr()->GetRegisteredType(&vec_ty);
  57. }
  58. analysis::Type* ConvertToHalfPass::FloatMatrixType(uint32_t v_cnt,
  59. uint32_t vty_id,
  60. uint32_t width) {
  61. Instruction* vty_inst = get_def_use_mgr()->GetDef(vty_id);
  62. uint32_t v_len = vty_inst->GetSingleWordInOperand(1);
  63. analysis::Type* reg_vec_ty = FloatVectorType(v_len, width);
  64. analysis::Matrix mat_ty(reg_vec_ty, v_cnt);
  65. return context()->get_type_mgr()->GetRegisteredType(&mat_ty);
  66. }
  67. uint32_t ConvertToHalfPass::EquivFloatTypeId(uint32_t ty_id, uint32_t width) {
  68. analysis::Type* reg_equiv_ty;
  69. Instruction* ty_inst = get_def_use_mgr()->GetDef(ty_id);
  70. if (ty_inst->opcode() == SpvOpTypeMatrix)
  71. reg_equiv_ty = FloatMatrixType(ty_inst->GetSingleWordInOperand(1),
  72. ty_inst->GetSingleWordInOperand(0), width);
  73. else if (ty_inst->opcode() == SpvOpTypeVector)
  74. reg_equiv_ty = FloatVectorType(ty_inst->GetSingleWordInOperand(1), width);
  75. else // SpvOpTypeFloat
  76. reg_equiv_ty = FloatScalarType(width);
  77. return context()->get_type_mgr()->GetTypeInstruction(reg_equiv_ty);
  78. }
  79. void ConvertToHalfPass::GenConvert(uint32_t* val_idp, uint32_t width,
  80. Instruction* inst) {
  81. Instruction* val_inst = get_def_use_mgr()->GetDef(*val_idp);
  82. uint32_t ty_id = val_inst->type_id();
  83. uint32_t nty_id = EquivFloatTypeId(ty_id, width);
  84. if (nty_id == ty_id) return;
  85. Instruction* cvt_inst;
  86. InstructionBuilder builder(
  87. context(), inst,
  88. IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping);
  89. if (val_inst->opcode() == SpvOpUndef)
  90. cvt_inst = builder.AddNullaryOp(nty_id, SpvOpUndef);
  91. else
  92. cvt_inst = builder.AddUnaryOp(nty_id, SpvOpFConvert, *val_idp);
  93. *val_idp = cvt_inst->result_id();
  94. }
  95. bool ConvertToHalfPass::MatConvertCleanup(Instruction* inst) {
  96. if (inst->opcode() != SpvOpFConvert) return false;
  97. uint32_t mty_id = inst->type_id();
  98. Instruction* mty_inst = get_def_use_mgr()->GetDef(mty_id);
  99. if (mty_inst->opcode() != SpvOpTypeMatrix) return false;
  100. uint32_t vty_id = mty_inst->GetSingleWordInOperand(0);
  101. uint32_t v_cnt = mty_inst->GetSingleWordInOperand(1);
  102. Instruction* vty_inst = get_def_use_mgr()->GetDef(vty_id);
  103. uint32_t cty_id = vty_inst->GetSingleWordInOperand(0);
  104. Instruction* cty_inst = get_def_use_mgr()->GetDef(cty_id);
  105. InstructionBuilder builder(
  106. context(), inst,
  107. IRContext::kAnalysisDefUse | IRContext::kAnalysisInstrToBlockMapping);
  108. // Convert each component vector, combine them with OpCompositeConstruct
  109. // and replace original instruction.
  110. uint32_t orig_width = (cty_inst->GetSingleWordInOperand(0) == 16) ? 32 : 16;
  111. uint32_t orig_mat_id = inst->GetSingleWordInOperand(0);
  112. uint32_t orig_vty_id = EquivFloatTypeId(vty_id, orig_width);
  113. std::vector<Operand> opnds = {};
  114. for (uint32_t vidx = 0; vidx < v_cnt; ++vidx) {
  115. Instruction* ext_inst = builder.AddIdLiteralOp(
  116. orig_vty_id, SpvOpCompositeExtract, orig_mat_id, vidx);
  117. Instruction* cvt_inst =
  118. builder.AddUnaryOp(vty_id, SpvOpFConvert, ext_inst->result_id());
  119. opnds.push_back({SPV_OPERAND_TYPE_ID, {cvt_inst->result_id()}});
  120. }
  121. uint32_t mat_id = TakeNextId();
  122. std::unique_ptr<Instruction> mat_inst(new Instruction(
  123. context(), SpvOpCompositeConstruct, mty_id, mat_id, opnds));
  124. (void)builder.AddInstruction(std::move(mat_inst));
  125. context()->ReplaceAllUsesWith(inst->result_id(), mat_id);
  126. // Turn original instruction into copy so it is valid.
  127. inst->SetOpcode(SpvOpCopyObject);
  128. inst->SetResultType(EquivFloatTypeId(mty_id, orig_width));
  129. get_def_use_mgr()->AnalyzeInstUse(inst);
  130. return true;
  131. }
  132. bool ConvertToHalfPass::RemoveRelaxedDecoration(uint32_t id) {
  133. return context()->get_decoration_mgr()->RemoveDecorationsFrom(
  134. id, [](const Instruction& dec) {
  135. if (dec.opcode() == SpvOpDecorate &&
  136. dec.GetSingleWordInOperand(1u) == SpvDecorationRelaxedPrecision)
  137. return true;
  138. else
  139. return false;
  140. });
  141. }
  142. bool ConvertToHalfPass::GenHalfArith(Instruction* inst) {
  143. bool modified = false;
  144. // Convert all float32 based operands to float16 equivalent and change
  145. // instruction type to float16 equivalent.
  146. inst->ForEachInId([&inst, &modified, this](uint32_t* idp) {
  147. Instruction* op_inst = get_def_use_mgr()->GetDef(*idp);
  148. if (!IsFloat(op_inst, 32)) return;
  149. GenConvert(idp, 16, inst);
  150. modified = true;
  151. });
  152. if (IsFloat(inst, 32)) {
  153. inst->SetResultType(EquivFloatTypeId(inst->type_id(), 16));
  154. converted_ids_.insert(inst->result_id());
  155. modified = true;
  156. }
  157. if (modified) get_def_use_mgr()->AnalyzeInstUse(inst);
  158. return modified;
  159. }
  160. bool ConvertToHalfPass::ProcessPhi(Instruction* inst, uint32_t from_width,
  161. uint32_t to_width) {
  162. // Add converts of any float operands to to_width if they are of from_width.
  163. // If converting to 16, change type of phi to float16 equivalent and remember
  164. // result id. Converts need to be added to preceding blocks.
  165. uint32_t ocnt = 0;
  166. uint32_t* prev_idp;
  167. bool modified = false;
  168. inst->ForEachInId([&ocnt, &prev_idp, &from_width, &to_width, &modified,
  169. this](uint32_t* idp) {
  170. if (ocnt % 2 == 0) {
  171. prev_idp = idp;
  172. } else {
  173. Instruction* val_inst = get_def_use_mgr()->GetDef(*prev_idp);
  174. if (IsFloat(val_inst, from_width)) {
  175. BasicBlock* bp = context()->get_instr_block(*idp);
  176. auto insert_before = bp->tail();
  177. if (insert_before != bp->begin()) {
  178. --insert_before;
  179. if (insert_before->opcode() != SpvOpSelectionMerge &&
  180. insert_before->opcode() != SpvOpLoopMerge)
  181. ++insert_before;
  182. }
  183. GenConvert(prev_idp, to_width, &*insert_before);
  184. modified = true;
  185. }
  186. }
  187. ++ocnt;
  188. });
  189. if (to_width == 16u) {
  190. inst->SetResultType(EquivFloatTypeId(inst->type_id(), 16u));
  191. converted_ids_.insert(inst->result_id());
  192. modified = true;
  193. }
  194. if (modified) get_def_use_mgr()->AnalyzeInstUse(inst);
  195. return modified;
  196. }
  197. bool ConvertToHalfPass::ProcessConvert(Instruction* inst) {
  198. // If float32 and relaxed, change to float16 convert
  199. if (IsFloat(inst, 32) && IsRelaxed(inst->result_id())) {
  200. inst->SetResultType(EquivFloatTypeId(inst->type_id(), 16));
  201. get_def_use_mgr()->AnalyzeInstUse(inst);
  202. converted_ids_.insert(inst->result_id());
  203. }
  204. // If operand and result types are the same, change FConvert to CopyObject to
  205. // keep validator happy; simplification and DCE will clean it up
  206. // One way this can happen is if an FConvert generated during this pass
  207. // (likely by ProcessPhi) is later encountered here and its operand has been
  208. // changed to half.
  209. uint32_t val_id = inst->GetSingleWordInOperand(0);
  210. Instruction* val_inst = get_def_use_mgr()->GetDef(val_id);
  211. if (inst->type_id() == val_inst->type_id()) inst->SetOpcode(SpvOpCopyObject);
  212. return true; // modified
  213. }
  214. bool ConvertToHalfPass::ProcessImageRef(Instruction* inst) {
  215. bool modified = false;
  216. // If image reference, only need to convert dref args back to float32
  217. if (dref_image_ops_.count(inst->opcode()) != 0) {
  218. uint32_t dref_id = inst->GetSingleWordInOperand(kImageSampleDrefIdInIdx);
  219. if (converted_ids_.count(dref_id) > 0) {
  220. GenConvert(&dref_id, 32, inst);
  221. inst->SetInOperand(kImageSampleDrefIdInIdx, {dref_id});
  222. get_def_use_mgr()->AnalyzeInstUse(inst);
  223. modified = true;
  224. }
  225. }
  226. return modified;
  227. }
  228. bool ConvertToHalfPass::ProcessDefault(Instruction* inst) {
  229. // If non-relaxed instruction has changed operands, need to convert
  230. // them back to float32
  231. if (inst->opcode() == SpvOpPhi) return ProcessPhi(inst, 16u, 32u);
  232. bool modified = false;
  233. inst->ForEachInId([&inst, &modified, this](uint32_t* idp) {
  234. if (converted_ids_.count(*idp) == 0) return;
  235. uint32_t old_id = *idp;
  236. GenConvert(idp, 32, inst);
  237. if (*idp != old_id) modified = true;
  238. });
  239. if (modified) get_def_use_mgr()->AnalyzeInstUse(inst);
  240. return modified;
  241. }
  242. bool ConvertToHalfPass::GenHalfInst(Instruction* inst) {
  243. bool modified = false;
  244. // Remember id for later deletion of RelaxedPrecision decoration
  245. bool inst_relaxed = IsRelaxed(inst->result_id());
  246. if (IsArithmetic(inst) && inst_relaxed)
  247. modified = GenHalfArith(inst);
  248. else if (inst->opcode() == SpvOpPhi && inst_relaxed)
  249. modified = ProcessPhi(inst, 32u, 16u);
  250. else if (inst->opcode() == SpvOpFConvert)
  251. modified = ProcessConvert(inst);
  252. else if (image_ops_.count(inst->opcode()) != 0)
  253. modified = ProcessImageRef(inst);
  254. else
  255. modified = ProcessDefault(inst);
  256. return modified;
  257. }
  258. bool ConvertToHalfPass::CloseRelaxInst(Instruction* inst) {
  259. if (inst->result_id() == 0) return false;
  260. if (IsRelaxed(inst->result_id())) return false;
  261. if (!IsFloat(inst, 32)) return false;
  262. if (IsDecoratedRelaxed(inst)) {
  263. AddRelaxed(inst->result_id());
  264. return true;
  265. }
  266. if (closure_ops_.count(inst->opcode()) == 0) return false;
  267. // Can relax if all float operands are relaxed
  268. bool relax = true;
  269. inst->ForEachInId([&relax, this](uint32_t* idp) {
  270. Instruction* op_inst = get_def_use_mgr()->GetDef(*idp);
  271. if (!IsFloat(op_inst, 32)) return;
  272. if (!IsRelaxed(*idp)) relax = false;
  273. });
  274. if (relax) {
  275. AddRelaxed(inst->result_id());
  276. return true;
  277. }
  278. // Can relax if all uses are relaxed
  279. relax = true;
  280. get_def_use_mgr()->ForEachUser(inst, [&relax, this](Instruction* uinst) {
  281. if (uinst->result_id() == 0 || !IsFloat(uinst, 32) ||
  282. (!IsDecoratedRelaxed(uinst) && !IsRelaxed(uinst->result_id()))) {
  283. relax = false;
  284. return;
  285. }
  286. });
  287. if (relax) {
  288. AddRelaxed(inst->result_id());
  289. return true;
  290. }
  291. return false;
  292. }
  293. bool ConvertToHalfPass::ProcessFunction(Function* func) {
  294. // Do a closure of Relaxed on composite and phi instructions
  295. bool changed = true;
  296. while (changed) {
  297. changed = false;
  298. cfg()->ForEachBlockInReversePostOrder(
  299. func->entry().get(), [&changed, this](BasicBlock* bb) {
  300. for (auto ii = bb->begin(); ii != bb->end(); ++ii)
  301. changed |= CloseRelaxInst(&*ii);
  302. });
  303. }
  304. // Do convert of relaxed instructions to half precision
  305. bool modified = false;
  306. cfg()->ForEachBlockInReversePostOrder(
  307. func->entry().get(), [&modified, this](BasicBlock* bb) {
  308. for (auto ii = bb->begin(); ii != bb->end(); ++ii)
  309. modified |= GenHalfInst(&*ii);
  310. });
  311. // Replace invalid converts of matrix into equivalent vector extracts,
  312. // converts and finally a composite construct
  313. cfg()->ForEachBlockInReversePostOrder(
  314. func->entry().get(), [&modified, this](BasicBlock* bb) {
  315. for (auto ii = bb->begin(); ii != bb->end(); ++ii)
  316. modified |= MatConvertCleanup(&*ii);
  317. });
  318. return modified;
  319. }
  320. Pass::Status ConvertToHalfPass::ProcessImpl() {
  321. Pass::ProcessFunction pfn = [this](Function* fp) {
  322. return ProcessFunction(fp);
  323. };
  324. bool modified = context()->ProcessReachableCallTree(pfn);
  325. // If modified, make sure module has Float16 capability
  326. if (modified) context()->AddCapability(SpvCapabilityFloat16);
  327. // Remove all RelaxedPrecision decorations from instructions and globals
  328. for (auto c_id : relaxed_ids_set_) {
  329. modified |= RemoveRelaxedDecoration(c_id);
  330. }
  331. for (auto& val : get_module()->types_values()) {
  332. uint32_t v_id = val.result_id();
  333. if (v_id != 0) {
  334. modified |= RemoveRelaxedDecoration(v_id);
  335. }
  336. }
  337. return modified ? Status::SuccessWithChange : Status::SuccessWithoutChange;
  338. }
  339. Pass::Status ConvertToHalfPass::Process() {
  340. Initialize();
  341. return ProcessImpl();
  342. }
  343. void ConvertToHalfPass::Initialize() {
  344. target_ops_core_ = {
  345. SpvOpVectorExtractDynamic,
  346. SpvOpVectorInsertDynamic,
  347. SpvOpVectorShuffle,
  348. SpvOpCompositeConstruct,
  349. SpvOpCompositeInsert,
  350. SpvOpCompositeExtract,
  351. SpvOpCopyObject,
  352. SpvOpTranspose,
  353. SpvOpConvertSToF,
  354. SpvOpConvertUToF,
  355. // SpvOpFConvert,
  356. // SpvOpQuantizeToF16,
  357. SpvOpFNegate,
  358. SpvOpFAdd,
  359. SpvOpFSub,
  360. SpvOpFMul,
  361. SpvOpFDiv,
  362. SpvOpFMod,
  363. SpvOpVectorTimesScalar,
  364. SpvOpMatrixTimesScalar,
  365. SpvOpVectorTimesMatrix,
  366. SpvOpMatrixTimesVector,
  367. SpvOpMatrixTimesMatrix,
  368. SpvOpOuterProduct,
  369. SpvOpDot,
  370. SpvOpSelect,
  371. SpvOpFOrdEqual,
  372. SpvOpFUnordEqual,
  373. SpvOpFOrdNotEqual,
  374. SpvOpFUnordNotEqual,
  375. SpvOpFOrdLessThan,
  376. SpvOpFUnordLessThan,
  377. SpvOpFOrdGreaterThan,
  378. SpvOpFUnordGreaterThan,
  379. SpvOpFOrdLessThanEqual,
  380. SpvOpFUnordLessThanEqual,
  381. SpvOpFOrdGreaterThanEqual,
  382. SpvOpFUnordGreaterThanEqual,
  383. };
  384. target_ops_450_ = {
  385. GLSLstd450Round, GLSLstd450RoundEven, GLSLstd450Trunc, GLSLstd450FAbs,
  386. GLSLstd450FSign, GLSLstd450Floor, GLSLstd450Ceil, GLSLstd450Fract,
  387. GLSLstd450Radians, GLSLstd450Degrees, GLSLstd450Sin, GLSLstd450Cos,
  388. GLSLstd450Tan, GLSLstd450Asin, GLSLstd450Acos, GLSLstd450Atan,
  389. GLSLstd450Sinh, GLSLstd450Cosh, GLSLstd450Tanh, GLSLstd450Asinh,
  390. GLSLstd450Acosh, GLSLstd450Atanh, GLSLstd450Atan2, GLSLstd450Pow,
  391. GLSLstd450Exp, GLSLstd450Log, GLSLstd450Exp2, GLSLstd450Log2,
  392. GLSLstd450Sqrt, GLSLstd450InverseSqrt, GLSLstd450Determinant,
  393. GLSLstd450MatrixInverse,
  394. // TODO(greg-lunarg): GLSLstd450ModfStruct,
  395. GLSLstd450FMin, GLSLstd450FMax, GLSLstd450FClamp, GLSLstd450FMix,
  396. GLSLstd450Step, GLSLstd450SmoothStep, GLSLstd450Fma,
  397. // TODO(greg-lunarg): GLSLstd450FrexpStruct,
  398. GLSLstd450Ldexp, GLSLstd450Length, GLSLstd450Distance, GLSLstd450Cross,
  399. GLSLstd450Normalize, GLSLstd450FaceForward, GLSLstd450Reflect,
  400. GLSLstd450Refract, GLSLstd450NMin, GLSLstd450NMax, GLSLstd450NClamp};
  401. image_ops_ = {SpvOpImageSampleImplicitLod,
  402. SpvOpImageSampleExplicitLod,
  403. SpvOpImageSampleDrefImplicitLod,
  404. SpvOpImageSampleDrefExplicitLod,
  405. SpvOpImageSampleProjImplicitLod,
  406. SpvOpImageSampleProjExplicitLod,
  407. SpvOpImageSampleProjDrefImplicitLod,
  408. SpvOpImageSampleProjDrefExplicitLod,
  409. SpvOpImageFetch,
  410. SpvOpImageGather,
  411. SpvOpImageDrefGather,
  412. SpvOpImageRead,
  413. SpvOpImageSparseSampleImplicitLod,
  414. SpvOpImageSparseSampleExplicitLod,
  415. SpvOpImageSparseSampleDrefImplicitLod,
  416. SpvOpImageSparseSampleDrefExplicitLod,
  417. SpvOpImageSparseSampleProjImplicitLod,
  418. SpvOpImageSparseSampleProjExplicitLod,
  419. SpvOpImageSparseSampleProjDrefImplicitLod,
  420. SpvOpImageSparseSampleProjDrefExplicitLod,
  421. SpvOpImageSparseFetch,
  422. SpvOpImageSparseGather,
  423. SpvOpImageSparseDrefGather,
  424. SpvOpImageSparseTexelsResident,
  425. SpvOpImageSparseRead};
  426. dref_image_ops_ = {
  427. SpvOpImageSampleDrefImplicitLod,
  428. SpvOpImageSampleDrefExplicitLod,
  429. SpvOpImageSampleProjDrefImplicitLod,
  430. SpvOpImageSampleProjDrefExplicitLod,
  431. SpvOpImageDrefGather,
  432. SpvOpImageSparseSampleDrefImplicitLod,
  433. SpvOpImageSparseSampleDrefExplicitLod,
  434. SpvOpImageSparseSampleProjDrefImplicitLod,
  435. SpvOpImageSparseSampleProjDrefExplicitLod,
  436. SpvOpImageSparseDrefGather,
  437. };
  438. closure_ops_ = {
  439. SpvOpVectorExtractDynamic,
  440. SpvOpVectorInsertDynamic,
  441. SpvOpVectorShuffle,
  442. SpvOpCompositeConstruct,
  443. SpvOpCompositeInsert,
  444. SpvOpCompositeExtract,
  445. SpvOpCopyObject,
  446. SpvOpTranspose,
  447. SpvOpPhi,
  448. };
  449. relaxed_ids_set_.clear();
  450. converted_ids_.clear();
  451. }
  452. } // namespace opt
  453. } // namespace spvtools