text
stringlengths 0
2.2M
|
---|
// Demonstrate that "regular" reads ignore the OOB byte sent to us
|
//
|
TEST_F(EventHandlerOobTest, SWALLOW_OOB) {
|
auto clientOps = [](int sockfd) {
|
{
|
std::array<char, 2> buffer = {"X"};
|
int n = send(sockfd, buffer.data(), 1, MSG_OOB);
|
PCHECK(n > 0);
|
}
|
{
|
std::array<char, 7> buffer = {"banana"};
|
int n = send(sockfd, buffer.data(), buffer.size(), 0);
|
PCHECK(n > 0);
|
}
|
};
|
runClient(clientOps);
|
acceptConn();
|
struct SockEvent : public EventHandler {
|
SockEvent(EventBase* eb, int fd)
|
: EventHandler(eb, NetworkSocket::fromFd(fd)), fd_(fd) {}
|
void handlerReady(uint16_t events) noexcept override {
|
std::array<char, 255> buffer;
|
ASSERT_TRUE(events & EventHandler::EventFlags::READ);
|
int n = recv(fd_, buffer.data(), buffer.size(), 0);
|
EXPECT_EQ(7, n);
|
EXPECT_EQ("banana", std::string(buffer.data()));
|
}
|
private:
|
int fd_;
|
} sockHandler(&eb, serverFd);
|
sockHandler.registerHandler(EventHandler::EventFlags::READ);
|
LOG(INFO) << "Registered Handler";
|
eb.loop();
|
}
|
#endif
|
#include <torch/csrc/jit/codegen/cuda/instrumentation.h>
|
#include <torch/csrc/jit/codegen/cuda/ir_iostream.h>
|
#include <torch/csrc/jit/codegen/cuda/kernel.h>
|
#include <torch/csrc/jit/codegen/cuda/kernel_expr_evaluator.h>
|
#include <torch/csrc/jit/codegen/cuda/kernel_ir_dispatch.h>
|
#include <torch/csrc/jit/codegen/cuda/lower2device.h>
|
#include <iostream>
|
#include <unordered_set>
|
namespace torch {
|
namespace jit {
|
namespace fuser {
|
namespace cuda {
|
IrBuilderPasskey::IrBuilderPasskey(IrContainer* ir_container)
|
: ir_container_(ir_container) {}
|
namespace kir {
|
namespace {
|
//! Scan all primary expressions in the Kernel IR and build
|
//! lists of specialized nodes and other interesting information
|
class KernelIrScanner : private IrVisitor {
|
public:
|
explicit KernelIrScanner(const Kernel* kernel) {
|
IrVisitor::handle(kernel->topLevelExprs());
|
const auto gpu_lower = GpuLower::current();
|
for (auto split : gpu_lower->nonDivisibleSplitInfo().splitsToValidate()) {
|
auto extent = split->in()->extent();
|
auto factor = split->factor();
|
summary_.splits_to_validate.emplace_back(extent, factor);
|
}
|
}
|
const auto& summary() const {
|
return summary_;
|
}
|
private:
|
using IrVisitor::handle;
|
void handle(Expr* expr) final {
|
IrVisitor::handle(expr);
|
for (auto inp : expr->inputs()) {
|
handle(inp);
|
}
|
for (auto out : expr->outputs()) {
|
handle(out);
|
}
|
}
|
void handle(Sync* sync) final {
|
// TODO: Move to a dedicated validation pass
|
// which is not on the common execution/compilation path
|
if (sync->isWarHazardSync()) {
|
++summary_.war_hazard_syncs_count;
|
}
|
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.