• Home
  • Raw
  • Download

Lines Matching full:nir

31 #include "compiler/nir/nir_builder.h"
45 nir_shader *nir = nir_load_libclc_shader(64, disk_cache, in load_clc_shader() local
48 if (nir == NULL) in load_clc_shader()
52 p_atomic_cmpxchg(&compiler->clc_shader, NULL, nir); in load_clc_shader()
55 ralloc_steal(compiler, nir); in load_clc_shader()
56 return nir; in load_clc_shader()
59 ralloc_free(nir); in load_clc_shader()
125 implement_intel_builtins(nir_shader *nir) in implement_intel_builtins() argument
129 nir_foreach_function(func, nir) { in implement_intel_builtins()
156 nir_shader_preserve_all_metadata(nir); in implement_intel_builtins()
162 lower_kernel_intrinsics(nir_shader *nir) in lower_kernel_intrinsics() argument
164 nir_function_impl *impl = nir_shader_get_entrypoint(nir); in lower_kernel_intrinsics()
170 nir->num_uniforms += kernel_arg_start; in lower_kernel_intrinsics()
185 nir_intrinsic_instr_create(nir, nir_intrinsic_load_uniform); in lower_kernel_intrinsics()
189 nir_intrinsic_set_range(load, nir->num_uniforms); in lower_kernel_intrinsics()
214 nir_intrinsic_instr_create(nir, nir_intrinsic_load_uniform); in lower_kernel_intrinsics()
300 nir_shader *nir = in brw_kernel_from_spirv() local
303 nir_validate_shader(nir, "after spirv_to_nir"); in brw_kernel_from_spirv()
304 nir_validate_ssa_dominance(nir, "after spirv_to_nir"); in brw_kernel_from_spirv()
305 ralloc_steal(mem_ctx, nir); in brw_kernel_from_spirv()
306 nir->info.name = ralloc_strdup(nir, entrypoint_name); in brw_kernel_from_spirv()
310 nir_foreach_function_impl(impl, nir) { in brw_kernel_from_spirv()
314 fprintf(stderr, "NIR (from SPIR-V) for kernel\n"); in brw_kernel_from_spirv()
315 nir_print_shader(nir, stderr); in brw_kernel_from_spirv()
318 NIR_PASS_V(nir, implement_intel_builtins); in brw_kernel_from_spirv()
319 NIR_PASS_V(nir, nir_link_shader_functions, spirv_options.clc_shader); in brw_kernel_from_spirv()
325 NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); in brw_kernel_from_spirv()
326 NIR_PASS_V(nir, nir_lower_returns); in brw_kernel_from_spirv()
327 NIR_PASS_V(nir, nir_inline_functions); in brw_kernel_from_spirv()
328 NIR_PASS_V(nir, nir_copy_prop); in brw_kernel_from_spirv()
329 NIR_PASS_V(nir, nir_opt_deref); in brw_kernel_from_spirv()
332 nir_remove_non_entrypoints(nir); in brw_kernel_from_spirv()
339 NIR_PASS_V(nir, nir_lower_variable_initializers, ~0); in brw_kernel_from_spirv()
346 NIR_PASS_V(nir, nir_lower_vec3_to_vec4, in brw_kernel_from_spirv()
354 NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, in brw_kernel_from_spirv()
361 brw_preprocess_nir(compiler, nir, &opts); in brw_kernel_from_spirv()
364 nir_foreach_uniform_variable(var, nir) { in brw_kernel_from_spirv()
369 kernel->args_size = nir->num_uniforms; in brw_kernel_from_spirv()
377 nir_foreach_uniform_variable(var, nir) { in brw_kernel_from_spirv()
382 assert(arg_desc.offset + arg_desc.size <= nir->num_uniforms); in brw_kernel_from_spirv()
388 NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_all, NULL); in brw_kernel_from_spirv()
393 nir->global_mem_size = 0; in brw_kernel_from_spirv()
394 nir->scratch_size = 0; in brw_kernel_from_spirv()
395 nir->info.shared_size = 0; in brw_kernel_from_spirv()
396 NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, in brw_kernel_from_spirv()
400 if (nir->constant_data_size > 0) { in brw_kernel_from_spirv()
401 assert(nir->constant_data == NULL); in brw_kernel_from_spirv()
402 nir->constant_data = rzalloc_size(nir, nir->constant_data_size); in brw_kernel_from_spirv()
403 nir_gather_explicit_io_initializers(nir, nir->constant_data, in brw_kernel_from_spirv()
404 nir->constant_data_size, in brw_kernel_from_spirv()
410 nir_foreach_function_impl(impl, nir) { in brw_kernel_from_spirv()
414 fprintf(stderr, "NIR (before I/O lowering) for kernel\n"); in brw_kernel_from_spirv()
415 nir_print_shader(nir, stderr); in brw_kernel_from_spirv()
418 NIR_PASS_V(nir, nir_lower_memcpy); in brw_kernel_from_spirv()
420 NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_constant, in brw_kernel_from_spirv()
423 NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_uniform, in brw_kernel_from_spirv()
426 NIR_PASS_V(nir, nir_lower_explicit_io, in brw_kernel_from_spirv()
431 NIR_PASS_V(nir, nir_lower_convert_alu_types, NULL); in brw_kernel_from_spirv()
433 NIR_PASS_V(nir, brw_nir_lower_cs_intrinsics, devinfo, NULL); in brw_kernel_from_spirv()
434 NIR_PASS_V(nir, lower_kernel_intrinsics); in brw_kernel_from_spirv()
439 kernel->prog_data.base.nr_params = DIV_ROUND_UP(nir->num_uniforms, 4); in brw_kernel_from_spirv()
443 .nir = nir, in brw_kernel_from_spirv()
491 nir_remove_llvm17_scratch(nir_shader *nir) in nir_remove_llvm17_scratch() argument
498 nir_foreach_function_impl(func, nir) { in nir_remove_llvm17_scratch()
519 nir_foreach_function_impl(func, nir) { in nir_remove_llvm17_scratch()
561 cleanup_llvm17_scratch(nir_shader *nir) in cleanup_llvm17_scratch() argument
567 NIR_PASS(progress, nir, nir_copy_prop); in cleanup_llvm17_scratch()
568 NIR_PASS(progress, nir, nir_opt_dce); in cleanup_llvm17_scratch()
569 NIR_PASS(progress, nir, nir_opt_constant_folding); in cleanup_llvm17_scratch()
570 NIR_PASS(progress, nir, nir_opt_cse); in cleanup_llvm17_scratch()
571 NIR_PASS(progress, nir, nir_opt_algebraic); in cleanup_llvm17_scratch()
575 nir_remove_llvm17_scratch(nir); in cleanup_llvm17_scratch()
581 NIR_PASS(progress, nir, nir_copy_prop); in cleanup_llvm17_scratch()
582 NIR_PASS(progress, nir, nir_opt_dce); in cleanup_llvm17_scratch()
583 NIR_PASS(progress, nir, nir_opt_constant_folding); in cleanup_llvm17_scratch()
584 NIR_PASS(progress, nir, nir_opt_cse); in cleanup_llvm17_scratch()
585 NIR_PASS(progress, nir, nir_opt_algebraic); in cleanup_llvm17_scratch()
635 nir_shader *nir = in brw_nir_from_spirv() local
638 nir_validate_shader(nir, "after spirv_to_nir"); in brw_nir_from_spirv()
639 nir_validate_ssa_dominance(nir, "after spirv_to_nir"); in brw_nir_from_spirv()
640 ralloc_steal(mem_ctx, nir); in brw_nir_from_spirv()
641 nir->info.name = ralloc_strdup(nir, "library"); in brw_nir_from_spirv()
645 nir_foreach_function_impl(impl, nir) { in brw_nir_from_spirv()
649 fprintf(stderr, "NIR (from SPIR-V) for kernel\n"); in brw_nir_from_spirv()
650 nir_print_shader(nir, stderr); in brw_nir_from_spirv()
653 NIR_PASS_V(nir, implement_intel_builtins); in brw_nir_from_spirv()
654 NIR_PASS_V(nir, nir_link_shader_functions, spirv_options.clc_shader); in brw_nir_from_spirv()
660 NIR_PASS_V(nir, nir_lower_variable_initializers, ~(nir_var_shader_temp | in brw_nir_from_spirv()
662 NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_uniform | nir_var_mem_ubo | in brw_nir_from_spirv()
669 NIR_PASS(progress, nir, nir_copy_prop); in brw_nir_from_spirv()
670 NIR_PASS(progress, nir, nir_opt_copy_prop_vars); in brw_nir_from_spirv()
671 NIR_PASS(progress, nir, nir_opt_deref); in brw_nir_from_spirv()
672 NIR_PASS(progress, nir, nir_opt_dce); in brw_nir_from_spirv()
673 NIR_PASS(progress, nir, nir_opt_undef); in brw_nir_from_spirv()
674 NIR_PASS(progress, nir, nir_opt_constant_folding); in brw_nir_from_spirv()
675 NIR_PASS(progress, nir, nir_opt_cse); in brw_nir_from_spirv()
676 NIR_PASS(progress, nir, nir_lower_vars_to_ssa); in brw_nir_from_spirv()
677 NIR_PASS(progress, nir, nir_opt_algebraic); in brw_nir_from_spirv()
681 NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); in brw_nir_from_spirv()
682 NIR_PASS_V(nir, nir_lower_returns); in brw_nir_from_spirv()
683 NIR_PASS_V(nir, nir_inline_functions); in brw_nir_from_spirv()
685 assert(nir->scratch_size == 0); in brw_nir_from_spirv()
686 …NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, nir_var_function_temp, glsl_get_cl_type_size_ali… in brw_nir_from_spirv()
693 NIR_PASS(progress, nir, nir_copy_prop); in brw_nir_from_spirv()
694 NIR_PASS(progress, nir, nir_opt_copy_prop_vars); in brw_nir_from_spirv()
695 NIR_PASS(progress, nir, nir_opt_deref); in brw_nir_from_spirv()
696 NIR_PASS(progress, nir, nir_opt_dce); in brw_nir_from_spirv()
697 NIR_PASS(progress, nir, nir_opt_undef); in brw_nir_from_spirv()
698 NIR_PASS(progress, nir, nir_opt_constant_folding); in brw_nir_from_spirv()
699 NIR_PASS(progress, nir, nir_opt_cse); in brw_nir_from_spirv()
700 NIR_PASS(progress, nir, nir_split_var_copies); in brw_nir_from_spirv()
701 NIR_PASS(progress, nir, nir_lower_var_copies); in brw_nir_from_spirv()
702 NIR_PASS(progress, nir, nir_lower_vars_to_ssa); in brw_nir_from_spirv()
703 NIR_PASS(progress, nir, nir_opt_algebraic); in brw_nir_from_spirv()
704 NIR_PASS(progress, nir, nir_opt_if, nir_opt_if_optimize_phi_true_false); in brw_nir_from_spirv()
705 NIR_PASS(progress, nir, nir_opt_dead_cf); in brw_nir_from_spirv()
706 NIR_PASS(progress, nir, nir_opt_remove_phis); in brw_nir_from_spirv()
707 NIR_PASS(progress, nir, nir_opt_peephole_select, 8, true, true); in brw_nir_from_spirv()
708 NIR_PASS(progress, nir, nir_lower_vec3_to_vec4, nir_var_mem_generic | nir_var_uniform); in brw_nir_from_spirv()
709 NIR_PASS(progress, nir, nir_opt_memcpy); in brw_nir_from_spirv()
713 NIR_PASS_V(nir, nir_scale_fdiv); in brw_nir_from_spirv()
715 NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_uniform | nir_var_mem_ubo | in brw_nir_from_spirv()
719 NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_mem_shared | nir_var_function_temp, NULL); in brw_nir_from_spirv()
721 nir->scratch_size = 0; in brw_nir_from_spirv()
722 NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, in brw_nir_from_spirv()
732 NIR_PASS(progress, nir, nir_opt_memcpy); in brw_nir_from_spirv()
733 NIR_PASS(progress, nir, nir_copy_prop); in brw_nir_from_spirv()
734 NIR_PASS(progress, nir, nir_opt_copy_prop_vars); in brw_nir_from_spirv()
735 NIR_PASS(progress, nir, nir_opt_deref); in brw_nir_from_spirv()
736 NIR_PASS(progress, nir, nir_opt_dce); in brw_nir_from_spirv()
737 NIR_PASS(progress, nir, nir_split_var_copies); in brw_nir_from_spirv()
738 NIR_PASS(progress, nir, nir_lower_var_copies); in brw_nir_from_spirv()
739 NIR_PASS(progress, nir, nir_lower_vars_to_ssa); in brw_nir_from_spirv()
740 NIR_PASS(progress, nir, nir_opt_constant_folding); in brw_nir_from_spirv()
741 NIR_PASS(progress, nir, nir_opt_cse); in brw_nir_from_spirv()
744 NIR_PASS_V(nir, nir_lower_memcpy); in brw_nir_from_spirv()
746 NIR_PASS_V(nir, nir_lower_explicit_io, in brw_nir_from_spirv()
750 NIR_PASS_V(nir, nir_lower_system_values); in brw_nir_from_spirv()
756 cleanup_llvm17_scratch(nir); in brw_nir_from_spirv()
761 nir->global_mem_size = 0; in brw_nir_from_spirv()
762 nir->scratch_size = 0; in brw_nir_from_spirv()
763 nir->info.shared_size = 0; in brw_nir_from_spirv()
764 NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, in brw_nir_from_spirv()
767 if (nir->constant_data_size > 0) { in brw_nir_from_spirv()
768 assert(nir->constant_data == NULL); in brw_nir_from_spirv()
769 nir->constant_data = rzalloc_size(nir, nir->constant_data_size); in brw_nir_from_spirv()
770 nir_gather_explicit_io_initializers(nir, nir->constant_data, in brw_nir_from_spirv()
771 nir->constant_data_size, in brw_nir_from_spirv()
775 NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_constant, in brw_nir_from_spirv()
778 NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_uniform, in brw_nir_from_spirv()
781 NIR_PASS_V(nir, nir_lower_explicit_io, in brw_nir_from_spirv()
788 nir_foreach_function_impl(impl, nir) { in brw_nir_from_spirv()
792 fprintf(stderr, "NIR (before I/O lowering) for kernel\n"); in brw_nir_from_spirv()
793 nir_print_shader(nir, stderr); in brw_nir_from_spirv()
796 return nir; in brw_nir_from_spirv()