void transpose(Param<T> out, CParam<T> in, const bool conjugate, const bool is32multiple) { static const std::string source(transpose_cuh, transpose_cuh_len); // clang-format off auto transpose = getKernel("cuda::transpose", source, { TemplateTypename<T>(), TemplateArg(conjugate), TemplateArg(is32multiple) }, { DefineValue(TILE_DIM), DefineValue(THREADS_Y) } ); // clang-format on dim3 threads(kernel::THREADS_X, kernel::THREADS_Y); int blk_x = divup(in.dims[0], TILE_DIM); int blk_y = divup(in.dims[1], TILE_DIM); dim3 blocks(blk_x * in.dims[2], blk_y * in.dims[3]); const int maxBlocksY = cuda::getDeviceProp(getActiveDeviceId()).maxGridSize[1]; blocks.z = divup(blocks.y, maxBlocksY); blocks.y = divup(blocks.y, blocks.z); EnqueueArgs qArgs(blocks, threads, getActiveStream()); transpose(qArgs, out, in, blk_x, blk_y); POST_LAUNCH_CHECK(); }
namespace InClassInitializers { // Noexcept::Noexcept() is implicitly declared as noexcept(false), because it // directly invokes ThrowSomething(). However... // // If noexcept(Noexcept()) is false, then Noexcept() is a constant expression, // so noexcept(Noexcept()) is true. But if noexcept(Noexcept()) is true, then // Noexcept::Noexcept is not declared constexpr, therefore noexcept(Noexcept()) // is false. bool ThrowSomething() noexcept(false); struct ConstExpr { bool b = noexcept(ConstExpr()) && ThrowSomething(); // expected-error {{exception specification is not available until end of class definition}} }; // We can use it now. bool w = noexcept(ConstExpr()); // Much more obviously broken: we can't parse the initializer without already // knowing whether it produces a noexcept expression. struct TemplateArg { int n = ExceptionIf<noexcept(TemplateArg())>::f(); // expected-error {{exception specification is not available until end of class definition}} }; bool x = noexcept(TemplateArg()); // And within a nested class. struct Nested { struct Inner { int n = ExceptionIf<noexcept(Nested())>::f(); // expected-error {{exception specification is not available until end of class definition}} } inner; }; bool y = noexcept(Nested()); bool z = noexcept(Nested::Inner()); }