[CODEGEN/DRIVER] Tweaks for performance optimization (#193)

This commit is contained in:
Philippe Tillet
2021-08-07 16:41:44 -07:00
committed by GitHub
parent 6cd1ec3955
commit 298da78058
8 changed files with 69 additions and 4 deletions

View File

@@ -98,6 +98,7 @@ struct dispatch{
// internal (debug/optimization)
static ir::value *multiple_of(ir::value *x, int value, ir::builder *builder);
static ir::value *max_contiguous(ir::value *x, int value, ir::builder *builder);
static ir::value *debug_barrier(ir::builder *builder);
};

View File

@@ -11,7 +11,8 @@ namespace ir{
class metadata{
public:
enum kind_t{
multiple_of
multiple_of,
max_contiguous
};
private:

View File

@@ -0,0 +1,37 @@
#ifndef TRITON_TOOLS_SYS_EXEC_HPP
#define TRITON_TOOLS_SYS_EXEC_HPP
#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
namespace triton
{
namespace tools
{
int exec(const std::string& cmd, std::string& result) {
char buffer[128];
FILE* pipe = popen(cmd.c_str(), "r");
if (!pipe)
return 0;
result.clear();
try {
while (fgets(buffer, sizeof buffer, pipe) != NULL)
result += buffer;
} catch (...) {
pclose(pipe);
return 0;
}
return WEXITSTATUS(pclose(pipe));
}
}
}
#endif