You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

checker.h 21 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. /**
  2. * \file dnn/test/common/checker.h
  3. * MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
  4. *
  5. * Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
  6. *
  7. * Unless required by applicable law or agreed to in writing,
  8. * software distributed under the License is distributed on an
  9. * "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. */
  11. #pragma once
  12. #include "megdnn/basic_types.h"
  13. #include "megdnn/tensor_iter.h"
  14. #include "test/common/opr_algo_proxy.h"
  15. #include "test/common/opr_proxy.h"
  16. #include "test/common/rng.h"
  17. #include <gtest/gtest.h>
  18. #include <memory>
  19. #include <regex>
  20. #include <unordered_map>
  21. // clang-format off
  22. #if defined(__has_feature)
  23. #if __has_feature(address_sanitizer)
  24. #define MEGDNN_TEST_ASAN 1
  25. #else
  26. #define MEGDNN_TEST_ASAN 0
  27. #endif
  28. #elif defined(__SANITIZE_ADDRESS__)
  29. #define MEGDNN_TEST_ASAN 1
  30. #else
  31. #define MEGDNN_TEST_ASAN 0
  32. #endif
  33. // clang-format on
  34. namespace megdnn {
  35. namespace test {
  36. class CheckerHelper {
  37. // TensorLayoutArray and TensorValueArray should be protected in theory;
  38. // but g++-4.9 bugs handle access privilege wrongfully, so we change it
  39. // to public.
  40. public:
  41. using TensorValueArray = TensorNDArray;
  42. using TensorsConstriant = std::function<void(TensorValueArray& tensors)>;
  43. using ExtraOprImpl = std::function<void(const TensorNDArray&)>;
  44. using OutputCanonizer = std::function<void(const TensorValueArray&)>;
  45. static std::shared_ptr<TensorValueArray> alloc_tensors(
  46. Handle* handle, const TensorLayoutArray& layouts, size_t offset);
  47. Handle* handle() const { return m_handle_cur; }
  48. protected:
  49. //! whether to use physically contiguous (i.e. default layout) for naive
  50. //! impl
  51. bool m_enable_contig_naive = false;
  52. bool m_prev_succ = true;
  53. const char* m_input_tensors_fpath = nullptr;
  54. thin_function<void()> m_expect_exec_fail;
  55. std::unique_ptr<Handle> m_handle_naive;
  56. Handle* m_handle_cur;
  57. std::unique_ptr<RNG> m_default_rng;
  58. std::unordered_map<size_t, RNG*> m_rng;
  59. std::unordered_map<size_t, DType> m_dtype;
  60. std::unordered_map<size_t, TensorFormat> m_fmt;
  61. float_t m_epsilon = 1e-3, m_max_avg_error = 1e-3,
  62. m_max_avg_biased_error = 1e-3;
  63. float_t m_perf_check_threshold = -1;
  64. bool m_perf_check = false;
  65. ExtraOprImpl m_extra_opr_impl;
  66. OutputCanonizer m_output_canonizer;
  67. TensorsConstriant m_tensor_constraint;
  68. /**
  69. * the offset from the start of malloc memory
  70. *
  71. * \note alloc \p m_offset more memory when alloc memory for a tensor,
  72. * the start of tensor just begin at \p m_offset.
  73. * \warning current only used for opencl
  74. */
  75. size_t m_offset = 0;
  76. CheckerHelper(Handle* handle, bool check_dispatch = true);
  77. ~CheckerHelper() noexcept;
  78. using OprExec = std::function<void(const TensorValueArray&)>;
  79. void do_exec_with_testcases(const TensorValueArray& testcase_in,
  80. const TensorValueArray& testcase_out,
  81. const OprExec& exec_opr);
  82. void do_exec(const TensorLayoutArray& user_layouts,
  83. const TensorLayoutArray& deduced_layouts,
  84. const OprExec& exec_naive, const OprExec& exec_opr);
  85. void enable_contig_naive() { m_enable_contig_naive = true; }
  86. private:
  87. std::shared_ptr<TensorValueArray> m_tensors_naive;
  88. void init_naive_values();
  89. void copy_tensors_to_device(const TensorValueArray& dest,
  90. const TensorValueArray& src);
  91. void copy_tensors_from_device(const TensorValueArray& dest,
  92. const TensorValueArray& src);
  93. void check_tensors(const TensorValueArray& expected,
  94. const TensorValueArray& computed);
  95. };
  96. template <typename Opr, typename Proxy = OprProxy<Opr>>
  97. class Checker : public CheckerHelper {
  98. public:
  99. using Param = typename Opr::Param;
  100. using BeforeExecCallback =
  101. std::function<void(Opr*, const TensorValueArray&)>;
  102. Checker(Handle* handle, bool check_dispatch = true)
  103. : CheckerHelper(handle, check_dispatch), m_param(Param()) {}
  104. TensorLayoutArray make_layouts(const TensorShapeArray& shapes) {
  105. TensorLayoutArray layouts(shapes.size());
  106. for (size_t i = 0; i < shapes.size(); ++i) {
  107. DType dt = (m_dtype.find(i) != m_dtype.end() ? m_dtype[i]
  108. : dtype::Float32());
  109. TensorFormat fmt =
  110. (m_fmt.find(i) != m_fmt.end() ? m_fmt[i] : TensorFormat{});
  111. layouts[i] = TensorLayout(shapes[i], dt, fmt);
  112. }
  113. return layouts;
  114. }
  115. /*!
  116. * \brief execute opr on current param/dtype/rng config
  117. * \param shapes input/output shapes, which would be passed as
  118. * arguments to Opr::deduce_layout
  119. *
  120. * Checker would construct TensorLayout vectors from shapes and dtypes,
  121. * and call exec(TensorLayoutArray &).
  122. */
  123. Checker& exec(const TensorShapeArray& shapes) {
  124. exec(make_layouts(shapes));
  125. return *this;
  126. }
  127. void exec(TensorLayoutArray layouts);
  128. //! explicitly require argument to be TensorShape
  129. Checker& execs(const TensorShapeArray& shapes) { return exec(shapes); }
  130. //! explicitly require argument to be TensorLayout
  131. Checker& execl(const TensorLayoutArray& layouts) {
  132. exec(layouts);
  133. return *this;
  134. }
  135. Checker& exect(const TensorValueArray& testcase_in,
  136. const TensorValueArray& testcase_out);
  137. Checker& set_param(Param param) {
  138. m_param = param;
  139. opr()->param() = param;
  140. return *this;
  141. }
  142. Checker& set_dtype(size_t idx, DType dtype) {
  143. m_dtype[idx] = dtype;
  144. return *this;
  145. }
  146. Checker& set_fmt(size_t idx, TensorFormat fmt) {
  147. m_fmt[idx] = fmt;
  148. return *this;
  149. }
  150. Checker& set_rng(size_t idx, RNG* rng) {
  151. m_rng[idx] = rng;
  152. return *this;
  153. }
  154. //! max error of a single element
  155. Checker& set_epsilon(dt_float32 epsilon) {
  156. m_epsilon = epsilon;
  157. m_max_avg_error = epsilon;
  158. m_max_avg_biased_error = epsilon;
  159. return *this;
  160. }
  161. //! max average error; defaults to epsilon
  162. Checker& set_max_avg_error(dt_float32 error) {
  163. m_max_avg_error = error;
  164. return *this;
  165. }
  166. //! max average biased error; defaults to epsilon
  167. Checker& set_max_avg_biased_error(dt_float32 error) {
  168. m_max_avg_biased_error = error;
  169. return *this;
  170. }
  171. Checker& set_offset(size_t offset) {
  172. m_offset = offset;
  173. return *this;
  174. }
  175. Checker& set_proxy(const Proxy& proxy) {
  176. m_naive_proxy = proxy;
  177. m_cur_proxy = proxy;
  178. return *this;
  179. }
  180. //! set_perf_check and set_perf_check_threshold control the
  181. //! performance checking behavior.
  182. //!
  183. //! If perf_check is on (default to off), the running time of the
  184. //! current operator and the naive operator would be measured and
  185. //! checked when calling exec.
  186. //! The accelerating ratio should be larger than perf_check_threshold,
  187. //! otherwise errors would be reported.
  188. //! perf_check_threshold must be set in advance since the default value
  189. //! (which is negative) is invalid.
  190. Checker& set_perf_check(bool perf_check) {
  191. m_perf_check = perf_check;
  192. return *this;
  193. }
  194. Checker& set_perf_check_threshold(float perf_check_threshold) {
  195. m_perf_check_threshold = perf_check_threshold;
  196. return *this;
  197. }
  198. //! load input tensors from file for next run
  199. Checker& load_input_tensors(const char* fpath) {
  200. m_input_tensors_fpath = fpath;
  201. return *this;
  202. }
  203. //! add another checker to ensure naive implementation is correct
  204. Checker& set_extra_opr_impl(const ExtraOprImpl& chk) {
  205. m_extra_opr_impl = chk;
  206. return *this;
  207. }
  208. //! set a callback to be invoked before executing the operator
  209. Checker& set_before_exec_callback(const BeforeExecCallback& cb) {
  210. m_before_exec_callback = cb;
  211. return *this;
  212. }
  213. Checker& reset_before_exec_callback() {
  214. m_before_exec_callback = nullptr;
  215. return *this;
  216. }
  217. //! set a tensors constraints function, for the purpose of manipulating
  218. //! tensors when testing.
  219. Checker& set_tensors_constraint(
  220. const TensorsConstriant& tensor_constraint) {
  221. m_tensor_constraint = tensor_constraint;
  222. return *this;
  223. }
  224. /*!
  225. * \brief set that exec() on opr should fail, so naive is not called and
  226. * exec() returns directly after opr is called.
  227. *
  228. * This is only valid for next exec() call. It is usually used for
  229. * testing megcore::AsyncErrorInfo.
  230. *
  231. * \param cb callback to be invoked after opr exec (so error would not
  232. * be passed to destructor)
  233. */
  234. Checker& set_expect_exec_fail(const thin_function<void()>& cb) {
  235. m_expect_exec_fail = cb;
  236. return *this;
  237. }
  238. /*!
  239. * \brief set a function to canonize the outputs
  240. *
  241. * For some oprs maybe multiple outputs can be accepted; we can use a
  242. * function to transform them into a canonized form before comparing.
  243. *
  244. * The arguments are tensors on CPU and should be modified in-place.
  245. */
  246. Checker& set_output_canonizer(OutputCanonizer canonizer) {
  247. m_output_canonizer = std::move(canonizer);
  248. return *this;
  249. }
  250. //! get the opr impl so setting other than param() can be modified
  251. Opr* opr() {
  252. if (!m_opr_cur) {
  253. m_opr_cur = m_handle_cur->create_operator<Opr>();
  254. }
  255. return m_opr_cur.get();
  256. }
  257. //! whether previous exec succeeds
  258. bool prev_succ() const { return m_prev_succ; }
  259. private:
  260. BeforeExecCallback m_before_exec_callback;
  261. Param m_param;
  262. Proxy m_naive_proxy, m_cur_proxy;
  263. std::unique_ptr<Opr> m_opr_cur;
  264. };
  265. ::testing::AssertionResult __assert_tensor_eq(
  266. const char* expr0, const char* expr1, const char* expr_maxerr,
  267. const char* expr_maxerr_avg, const char* expr_maxerr_avg_biased,
  268. const TensorND& v0, const TensorND& v1, float maxerr, float maxerr_avg,
  269. float maxerr_avg_biased);
  270. #define MEGDNN_ASSERT_TENSOR_EQ_EPS_AVG(v0, v1, maxerr, maxerr_avg, \
  271. maxerr_avg_biased) \
  272. ASSERT_PRED_FORMAT5(::megdnn::test::__assert_tensor_eq, v0, v1, maxerr, \
  273. maxerr_avg, maxerr_avg_biased)
  274. #define MEGDNN_ASSERT_TENSOR_EQ_EPS(v0, v1, maxerr) \
  275. MEGDNN_ASSERT_TENSOR_EQ_EPS_AVG(v0, v1, maxerr, maxerr, maxerr)
  276. #define MEGDNN_ASSERT_TENSOR_EQ(v0, v1) \
  277. MEGDNN_ASSERT_TENSOR_EQ_EPS(v0, v1, 1e-3)
  278. template <typename Opr, typename Proxy>
  279. void Checker<Opr, Proxy>::exec(TensorLayoutArray layouts) {
  280. auto opr_naive = m_handle_naive->create_operator<Opr>();
  281. auto opr_relayout = m_handle_naive->create_operator<RelayoutForward>();
  282. auto opr_cur = this->opr();
  283. opr_naive->param() = m_param;
  284. opr_cur->param() = m_param;
  285. m_naive_proxy.deduce_layout(opr_naive.get(), layouts);
  286. auto exec_naive = [this, &opr_naive, &layouts,
  287. &opr_relayout](const TensorValueArray& values) {
  288. TensorValueArray contig_values = values;
  289. TensorValueArray real_values = values;
  290. std::shared_ptr<TensorValueArray> tensors_naive_contig_storage;
  291. if (m_enable_contig_naive) {
  292. TensorLayoutArray contig_layouts;
  293. for (auto&& layout : layouts) {
  294. contig_layouts.emplace_back(TensorLayout{
  295. static_cast<const TensorShape&>(layout), layout.dtype});
  296. }
  297. m_naive_proxy.deduce_layout(opr_naive.get(), contig_layouts);
  298. tensors_naive_contig_storage = alloc_tensors(
  299. m_handle_naive.get(), contig_layouts, m_offset);
  300. contig_values = *tensors_naive_contig_storage;
  301. //! relayout value to the contig_values
  302. for (size_t i = 0; i < contig_values.size(); ++i) {
  303. if (real_values[i].layout.ndim == 0)
  304. continue;
  305. real_values[i].layout.format = {};
  306. opr_relayout->exec(real_values[i], contig_values[i],
  307. m_handle_naive.get());
  308. }
  309. }
  310. m_naive_proxy.exec(opr_naive.get(), contig_values);
  311. if (m_enable_contig_naive) {
  312. //! relayout to the values
  313. for (size_t i = 0; i < contig_values.size(); ++i) {
  314. if (real_values[i].layout.ndim == 0)
  315. continue;
  316. opr_relayout->exec(contig_values[i], real_values[i],
  317. m_handle_naive.get());
  318. }
  319. }
  320. };
  321. auto exec_opr = [this, opr_cur](const TensorValueArray& values) {
  322. if (m_before_exec_callback) {
  323. m_before_exec_callback(opr_cur, values);
  324. }
  325. m_cur_proxy.exec(opr_cur, values);
  326. };
  327. auto user_layouts = layouts;
  328. do_exec(user_layouts, layouts, exec_naive, exec_opr);
  329. }
  330. template <typename Opr, typename Proxy>
  331. Checker<Opr, Proxy>& Checker<Opr, Proxy>::exect(
  332. const TensorValueArray& testcase_in,
  333. const TensorValueArray& testcase_out) {
  334. auto opr_cur = this->opr();
  335. opr_cur->param() = m_param;
  336. auto exec_opr = [this, opr_cur](const TensorValueArray& values) {
  337. if (m_before_exec_callback) {
  338. m_before_exec_callback(opr_cur, values);
  339. }
  340. m_cur_proxy.exec(opr_cur, values);
  341. };
  342. do_exec_with_testcases(testcase_in, testcase_out, exec_opr);
  343. return *this;
  344. }
  345. template <typename T, typename U>
  346. TensorND TensorValue(const TensorShape& shape, T dtype,
  347. std::initializer_list<U> values) {
  348. TensorND tensor;
  349. tensor.layout = {shape, dtype};
  350. tensor.raw_ptr =
  351. static_cast<dt_byte*>(malloc(tensor.layout.span().dist_byte()));
  352. megdnn_assert(values.size() == tensor.layout.total_nr_elems(), "%zu == %zu",
  353. values.size(), tensor.layout.total_nr_elems());
  354. auto ptr = tensor.ptr<typename DTypeTrait<T>::ctype>();
  355. for (const auto& v : values) {
  356. *ptr++ = typename DTypeTrait<T>::ctype(v);
  357. }
  358. return tensor;
  359. }
  360. template <typename T, typename U>
  361. TensorND TensorValueLowbit4(const TensorShape& shape, T dtype,
  362. std::vector<U> values) {
  363. TensorND tensor;
  364. tensor.layout = {shape, dtype};
  365. tensor.raw_ptr =
  366. static_cast<dt_byte*>(malloc(tensor.layout.span().dist_byte()));
  367. megdnn_assert(values.size() == tensor.layout.total_nr_elems());
  368. auto ptr = static_cast<U*>(tensor.raw_ptr);
  369. for (size_t i = 0; i < values.size(); i += 2) {
  370. U val0 = values[i], val1 = values[i + 1];
  371. megdnn_assert(val0 >= DTypeTrait<T>::min());
  372. megdnn_assert(val1 <= DTypeTrait<T>::max());
  373. ptr[i / 2] = (val0 & 0xF) | (val1 << 4);
  374. }
  375. return tensor;
  376. }
  377. class Testcase : public SmallVector<TensorND> {
  378. public:
  379. using SmallVector<TensorND>::SmallVector;
  380. ~Testcase() {
  381. // Suicide
  382. for (const auto& tensor : *this) {
  383. if (tensor.raw_ptr) {
  384. free(tensor.raw_ptr);
  385. }
  386. }
  387. }
  388. Testcase(const Testcase&) = delete;
  389. Testcase operator=(const Testcase&) = delete;
  390. };
  391. struct ExecutionPolicyAlgoName {
  392. std::string name;
  393. std::vector<ExecutionPolicyAlgoName> sub_policy_names;
  394. ExecutionPolicyAlgoName(const char* name) : name{name} {}
  395. ExecutionPolicyAlgoName(
  396. const char* name,
  397. const std::vector<ExecutionPolicyAlgoName>& sub_policy)
  398. : name{name}, sub_policy_names{sub_policy} {}
  399. };
  400. /*!
  401. * \brief a callable to check that given algorithm is used for heuristic
  402. * \param require_algo if its value is true, then requires
  403. * get_algorithm_heuristic() to return the expected algo; otherwise the
  404. * expected algo must exist in get_all_algorithms() and it would be set to
  405. * be used
  406. */
  407. template <class Opr, typename OprAlgoProxy = OprAlgoProxy<Opr>>
  408. class AlgoChecker {
  409. public:
  410. AlgoChecker(ExecutionPolicyAlgoName name, bool* require_algo = nullptr)
  411. : m_policy_name{name}, m_require_algo{require_algo} {}
  412. AlgoChecker(ExecutionPolicy policy, bool* require_algo = nullptr)
  413. : m_policy{policy}, m_require_algo{require_algo} {}
  414. static ExecutionPolicy construct_execution_policy_from_name(
  415. const ExecutionPolicyAlgoName& policy_name,
  416. const TensorLayoutArray& layouts, const std::string& param,
  417. Handle* handle) {
  418. ExecutionPolicy ret;
  419. megdnn_assert(layouts.size() == OprTrait<Opr>::arity);
  420. auto opr = handle->create_operator<Opr>();
  421. opr->param() =
  422. Algorithm::deserialize_read_pod<typename Opr::Param>(param);
  423. for (auto algo_info :
  424. AlgoProxy<Opr, OprTrait<Opr>::arity>::get_all_algorithms_info(
  425. opr.get(), layouts)) {
  426. if (std::regex_match(
  427. algo_info.name,
  428. std::regex("(" + policy_name.name + ")(.*)"))) {
  429. ret.algo = algo_info.desc;
  430. } else {
  431. continue;
  432. }
  433. Algorithm* algo = opr->get_algorithm_from_desc(algo_info.desc);
  434. std::vector<Algorithm::SearchItem>&& sub_items =
  435. algo->get_subopr_list(layouts, opr.get());
  436. if (sub_items.size() != policy_name.sub_policy_names.size()) {
  437. printf("Invalid sub_policy_names in %s, expected %zu but got "
  438. "%zu\n",
  439. algo_info.name.c_str(), sub_items.size(),
  440. policy_name.sub_policy_names.size());
  441. return {};
  442. }
  443. FOREACH_OPR_TYPE_DISPATCH(sub_items, {
  444. ExecutionPolicy policy =
  445. AlgoChecker<_Opr>::construct_execution_policy_from_name(
  446. policy_name.sub_policy_names[_item_idx],
  447. _item.layouts, _item.param, handle);
  448. ret.sub_policy.push_back(policy);
  449. });
  450. return ret;
  451. }
  452. return ret;
  453. }
  454. void operator()(Opr* opr, const CheckerHelper::TensorValueArray& arr) {
  455. TensorLayoutArray layouts;
  456. for (auto&& val : arr) {
  457. layouts.push_back(val.layout);
  458. }
  459. if (!m_policy_name.name.empty()) {
  460. std::string param_str;
  461. Algorithm::serialize_write_pod(opr->param(), param_str);
  462. m_policy = construct_execution_policy_from_name(
  463. m_policy_name, layouts, param_str, opr->handle());
  464. ASSERT_TRUE(m_policy.algo.valid())
  465. << "algorithm " << m_policy_name.name << " not found";
  466. }
  467. if (m_require_algo && *m_require_algo) {
  468. auto algo =
  469. OprAlgoProxy::get_algorithm_info_heuristic(opr, layouts);
  470. ASSERT_STREQ(opr->get_algorithm_from_desc(m_policy.algo)->name(),
  471. algo.name.c_str());
  472. } else {
  473. opr->execution_policy() = m_policy;
  474. }
  475. }
  476. private:
  477. ExecutionPolicyAlgoName m_policy_name;
  478. ExecutionPolicy m_policy;
  479. bool* m_require_algo;
  480. };
  481. template <typename Opr>
  482. void construct_sub_execution_policy_heuristic(ExecutionPolicy& policy,
  483. const TensorLayoutArray& layouts,
  484. const std::string& param,
  485. Handle* handle) {
  486. megdnn_assert(layouts.size() == OprTrait<Opr>::arity);
  487. auto opr = handle->create_operator<Opr>();
  488. opr->param() = Algorithm::deserialize_read_pod<typename Opr::Param>(param);
  489. if (!policy.algo.valid()) {
  490. policy.algo = AlgoProxy<Opr, OprTrait<Opr>::arity>::
  491. get_algorithm_info_heuristic(opr.get(), layouts).desc;
  492. }
  493. Algorithm* algo = opr->get_algorithm_from_desc(policy.algo);
  494. std::vector<Algorithm::SearchItem>&& sub_items =
  495. algo->get_subopr_list(layouts, opr.get());
  496. FOREACH_OPR_TYPE_DISPATCH(sub_items, {
  497. policy.sub_policy.push_back(ExecutionPolicy{});
  498. construct_sub_execution_policy_heuristic<_Opr>(
  499. policy.sub_policy.back(), _item.layouts, _item.param,
  500. handle);
  501. });
  502. }
  503. } // namespace test
  504. } // namespace megdnn
  505. // vim: syntax=cpp.doxygen

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台