Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple plugin to detect arithmetic exceptions #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ add_library(oclgrind ${CORE_LIB_TYPE}
src/core/WorkItem.cpp
src/core/WorkItemBuiltins.cpp
src/core/WorkGroup.cpp
src/plugins/ArithmeticExceptions.h
src/plugins/ArithmeticExceptions.cpp
src/plugins/InstructionCounter.h
src/plugins/InstructionCounter.cpp
src/plugins/InteractiveDebugger.h
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ liboclgrind_la_SOURCES = src/core/common.h src/core/common.cpp \
src/core/Queue.h src/core/Queue.cpp src/core/WorkItem.h \
src/core/WorkItem.cpp src/core/WorkItemBuiltins.cpp \
src/core/WorkGroup.h src/core/WorkGroup.cpp \
src/plugins/ArithmeticExceptions.h src/plugins/ArithmeticExceptions.cpp \
src/plugins/InstructionCounter.h src/plugins/InstructionCounter.cpp \
src/plugins/InteractiveDebugger.h src/plugins/InteractiveDebugger.cpp \
src/plugins/Logger.h src/plugins/Logger.cpp src/plugins/MemCheck.h \
Expand Down
4 changes: 4 additions & 0 deletions src/core/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "plugins/MemCheck.h"
#include "plugins/RaceDetector.h"
#include "plugins/Uninitialized.h"
#include "plugins/ArithmeticExceptions.h"

using namespace oclgrind;
using namespace std;
Expand Down Expand Up @@ -97,6 +98,9 @@ void Context::loadPlugins()
if (checkEnv("OCLGRIND_INTERACTIVE"))
m_plugins.push_back(make_pair(new InteractiveDebugger(this), true));

if (checkEnv("OCLGRIND_ARITHMETIC_EXCEPTIONS"))
m_plugins.push_back(make_pair(new ArithmeticExceptions(this), true));


// Load dynamic plugins
const char *dynamicPlugins = getenv("OCLGRIND_PLUGINS");
Expand Down
8 changes: 7 additions & 1 deletion src/kernel/oclgrind-kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ static bool parseArguments(int argc, char *argv[])
{
for (int i = 1; i < argc; i++)
{
if (!strcmp(argv[i], "--build-options"))
if (!strcmp(argv[i], "--arithmetic-exceptions"))
{
setEnvironment("OCLGRIND_ARITHMETIC_EXCEPTIONS", "1");
}
else if (!strcmp(argv[i], "--build-options"))
{
if (++i >= argc)
{
Expand Down Expand Up @@ -190,6 +194,8 @@ static void printUsage()
<< " oclgrind-kernel [--help | --version]" << endl
<< endl
<< "Options:" << endl
<< " --arithmetic-exceptions "
"Enable detection of arithmetic exceptions" << endl
<< " --build-options OPTIONS "
"Additional options to pass to the OpenCL compiler" << endl
<< " --data-races "
Expand Down
Loading