Public Types | |
| using | Super = ll::Emitter |
| Public Types inherited from mim::plug::ll::Emitter | |
| enum class | Rt { embed , ext } |
| How the C runtime wrappers (compiled to a <name>.ll via add_mim_runtime) reach the output. More... | |
| using | Super = mim::Emitter<std::string, std::string, BB, Emitter> |
Public Member Functions | |
| HostEmitter (World &world, std::ostream &ostream, std::optional< std::string > device_fatbin_file) | |
| void | start () final |
| Actual entry. | |
| void | find_kernels (const Def *) |
| std::optional< std::string > | isa_targetspecific_intrinsic (ll::BB &, const Def *) final |
| Public Member Functions inherited from mim::plug::ll::Emitter | |
| Emitter (World &world, std::string name, std::ostream &ostream) | |
| bool | is_valid (std::string_view s) |
| void | emit_imported (Lam *) |
| virtual std::string | prepare () |
| virtual void | emit_epilogue (Lam *lam) |
| void | finalize () |
| std::string | emit_bb (BB &bb, const Def *def) |
| template<class... Args> | |
| void | declare (std::format_string< Args... > s, Args &&... args) |
| void | rt_mode (Rt rt) |
| void | rt_module (std::string ll) |
| Provides the textual LLVM IR of the runtime module to splice in Rt::embed mode. | |
| bool | load_rt_module (std::string_view filename) |
| Locates the runtime module rt/<filename> (produced by add_mim_runtime) in the driver's search paths, reads it, and stores it for Rt::embed splicing. | |
| template<class... Args> | |
| void | declare_rt (std::format_string< Args... > sig, Args &&... args) |
Declares a runtime wrapper sig (implemented in a C runtime, see add_mim_runtime) and records that the runtime is required by this module. | |
| Public Member Functions inherited from mim::NestPhase< Lam > | |
| NestPhase (World &world, std::string name, bool elide_empty, bool schedule=false) | |
| const Nest & | nest () const |
| Public Member Functions inherited from mim::ClosedMutPhase< Lam > | |
| ClosedMutPhase (World &world, std::string name, bool elide_empty, bool schedule=false) | |
| bool | elide_empty () const |
| bool | schedule () const |
| Public Member Functions inherited from mim::Phase | |
| Phase (World &world, std::string name) | |
| Phase (World &world, flags_t annex) | |
| virtual | ~Phase ()=default |
| virtual std::unique_ptr< Phase > | recreate () |
| Creates a new instance; needed by a fixed-point PhaseMan. | |
| virtual void | apply (const App *) |
| Invoked if your Phase has additional args. | |
| virtual void | apply (Phase &) |
| Dito, but invoked by Phase::recreate. | |
| virtual bool | redirects () const |
| If true, Phase::create uses take_resolved(). | |
| virtual std::unique_ptr< Phase > | take_resolved () |
| The Phase to use instead; nullptr means elide. | |
| World & | world () |
| Driver & | driver () |
| Log & | log () const |
| std::string_view | name () const |
| flags_t | annex () const |
| const Vector< std::string > & | args () |
| Command-line arguments passed to this Phase's plugin via -X <plugin>:<arg>. | |
| bool | todo () const |
| void | invalidate (bool todo=true) |
| Signals that another round of fixed-point iteration is required, either as part of. | |
| virtual void | run () |
| Entry point and generates some debug output; invokes Phase::start. | |
| void | profile_count (std::string_view key, uint64_t n=1) |
Adds n to the custom Profiler counter key of the current run; no-op unless profiling is enabled. | |
Protected Member Functions | |
| std::string | convert (const Def *, bool simd=true) override |
| Protected Member Functions inherited from mim::plug::ll::Emitter | |
| std::string | id (const Def *, bool force_bb=false) const |
| std::string | convert_ret_pi (const Pi *) |
| void | emit_phi (Lam *callee, const Def *phi, std::string arg, Lam *pred) |
Registers arg as an incoming phi value for phi in callee, coming from predecessor pred. | |
| void | emit_phi_args (Lam *callee, const App *app, Lam *pred) |
Wires all non-mem.M arguments of app into callee's phis, coming from predecessor pred. | |
| virtual std::string | emit_slot (BB &bb, const App *app, const Def *pointee, const Def *) |
Emits the storage backing a mem.slot of type pointee and yields the pointer value. | |
| Protected Member Functions inherited from mim::Emitter< std::string, std::string, BB, Emitter > | |
| Emitter (World &world, std::string name, std::ostream &ostream, bool schedule=false) | |
| virtual bool | direct_style () |
| std::ostream & | ostream () const |
| std::string | emit (const Def *def) |
| Recursively emits code. | |
| std::string | emit_unsafe (const Def *def) |
| As above but returning !child().is_valid(value) is permitted. | |
| void | visit (const Nest &nest) override |
| Protected Member Functions inherited from mim::ClosedMutPhase< Lam > | |
| virtual void | visit (Lam *)=0 |
| Lam * | root () const |
Additional Inherited Members | |
| Static Public Member Functions inherited from mim::Phase | |
| static std::unique_ptr< Phase > | create (const Flags2Phases &phases, const Def *def) |
| template<class A, class P> | |
| static void | hook (Flags2Phases &phases) |
| template<class P, class... Args> | |
| static void | run (Args &&... args) |
| Runs a single Phase. | |
| Public Attributes inherited from mim::Emitter< std::string, std::string, BB, Emitter > | |
| fe::Tab | tab |
| Protected Attributes inherited from mim::plug::ll::Emitter | |
| absl::btree_set< std::string > | decls_ |
| std::ostringstream | type_decls_ |
| std::ostringstream | vars_decls_ |
| std::ostringstream | func_decls_ |
| std::ostringstream | func_impls_ |
| LamMap< const Def * > | simd_phi_ |
| Rt | rt_ = Rt::embed |
| bool | rt_used_ = false |
| std::string | rt_module_ |
| Protected Attributes inherited from mim::Emitter< std::string, std::string, BB, Emitter > | |
| Lam * | curr_lam_ |
| std::ostream & | ostream_ |
| Scheduler | scheduler_ |
| DefMap< std::string > | locals_ |
| DefMap< std::string > | globals_ |
| DefMap< std::string > | types_ |
| LamMap< BB > | lam2bb_ |
| Protected Attributes inherited from mim::Phase | |
| std::string | name_ |
Definition at line 23 of file ll_nvptx.cpp.
Definition at line 25 of file ll_nvptx.cpp.
|
inline |
Definition at line 27 of file ll_nvptx.cpp.
References mim::Emitter< std::string, std::string, BB, Emitter >::ostream(), and mim::Phase::world().
|
overrideprotectedvirtual |
Reimplemented from mim::plug::ll::Emitter.
Definition at line 152 of file ll_nvptx.cpp.
References mim::plug::ll::Emitter::convert(), mim::Axm::isa(), and mim::Lit::isa().
Referenced by mim::plug::ll_nvptx::DeviceEmitter::emit_slot(), isa_targetspecific_intrinsic(), and mim::plug::ll_nvptx::DeviceEmitter::prepare().
| void mim::plug::ll_nvptx::HostEmitter::find_kernels | ( | const Def * | def | ) |
Definition at line 107 of file ll_nvptx.cpp.
References mim::Def::deps(), find_kernels(), and mim::Axm::isa().
Referenced by find_kernels(), and start().
|
finalvirtual |
Reimplemented from mim::plug::ll::Emitter.
Definition at line 164 of file ll_nvptx.cpp.
References mim::plug::ll::BB::assign(), mim::plug::gpu::asyn, mim::plug::gpu::block, mim::plug::ll::BB::body(), convert(), mim::plug::ll_nvptx::Cu_Ctx_Create, mim::plug::ll_nvptx::Cu_Ctx_Destroy, mim::plug::ll_nvptx::Cu_Device_Get, mim::plug::ll_nvptx::Cu_Init, mim::plug::ll_nvptx::Cu_Launch_Kernel, mim::plug::ll_nvptx::Cu_Mem_Alloc, mim::plug::ll_nvptx::Cu_Mem_Alloc_Async, mim::plug::ll_nvptx::Cu_Mem_Free, mim::plug::ll_nvptx::Cu_Mem_Free_Async, mim::plug::ll_nvptx::Cu_Memcpy_Dtoh, mim::plug::ll_nvptx::Cu_Memcpy_Dtoh_Async, mim::plug::ll_nvptx::Cu_Memcpy_Htod, mim::plug::ll_nvptx::Cu_Memcpy_Htod_Async, mim::plug::ll_nvptx::Cu_Module_Get_Function, mim::plug::ll_nvptx::Cu_Module_Load_Fatbin, mim::plug::ll_nvptx::Cu_Module_Unload, mim::plug::ll_nvptx::Cu_Stream_Create, mim::plug::ll_nvptx::Cu_Stream_Destroy, mim::plug::ll_nvptx::Cu_Stream_Sync, mim::plug::ll::Emitter::declare(), mim::Emitter< std::string, std::string, BB, Emitter >::emit_unsafe(), mim::Axm::expect(), mim::Lit::expect(), mim::plug::ll::Emitter::id(), mim::Axm::isa(), mim::Def::isa_mut(), mim::Phase::name(), mim::Def::proj(), mim::plug::core::size, start(), mim::plug::ll::BB::tail(), mim::Def::type(), mim::plug::ll::Emitter::vars_decls_, and mim::Phase::world().
|
finalvirtual |
Actual entry.
Reimplemented from mim::plug::ll::Emitter.
Definition at line 90 of file ll_nvptx.cpp.
References find_kernels(), mim::plug::ll::Emitter::id(), mim::Phase::name(), mim::plug::ll::Emitter::start(), mim::plug::ll::Emitter::vars_decls_, and mim::Phase::world().
Referenced by isa_targetspecific_intrinsic().